CI 묻고 답하기

제목 로그인 관련 질문...
글쓴이 케케케 작성시각 2013/02/14 10:09:57
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 13919   RSS

<?
class Account extends CI_Controller
{
function Account()
{
 parent::__construct();
 $this->load->library(array('form_validation', 'session'));
 $this->load->helper(array('url', 'form'));
 $this->load->model('account_model');
 }
 function index()
 {
  $this->load->view('account/details');
  
 }

    function login()
     {
         /* 콜백은 폼필드의 내용을 인증하려 작성한 함수 */
     $this->form_validation->set_rules('id', 'id', 'xss_clean|trim|required');
  $this->form_validation->set_rules('pw', 'pw', 'xss_clean|trim|required|sha1|callback_pw_check');       
  $this->id = $this->input->post('id');
        $this->pw = sha1($this->input->post('pw'));

         if ($this->form_validation->run() == false)
         {
             $this->load->view('myform');
         }
         else
         {
             $this->account_model->login();
             $this->load->view('formsuccess');
         }
     }
     function pw_check()
     {
   $this->db->select('*');
         $this->db->where('id', $this->id);

         $query = $this->db->get('admin');

         $result = $query->row_array();
         if ($query->num_rows() == 0)
         {
             $this->form_validation->set_message('pw_check', '존재하지 않는 아이디입니다.');
             return false;
         }

   if ($result['pw'] == $this->pw)
         {
             return true;
         }
   else
   {
    return false;  
   }
     
     }
}

로그인 관련 controller입니다
User_Authentication(사용자_검증)_1 을 참조해서 제가 버전이나 변수만 맞게 고쳐본거입니다


로그인 할시 제가 만든 db에 업는 아이디로 로그인시 저기있는 경고메세지(존재하지 않는 아이디)가 뜹니다.
하지만 db에 존재하는 아이디로 로그인시 비밀번호를 맞게 하든 틀리게하든 오류구문이뜨네여...

뷰 페이지에 있는 <?php echo validation_errors(); ?> 가 에러가 뜨네요....

무엇이 틀렷을까요 ㅠ
에러메세지는 Unable to access an error message corresponding to your field name. 입니다
 

 다음글 require_once 질문. (4)
 이전글 한글(hwp) 문서 인코딩 문제.. (5)

댓글

변종원(웅파) / 2013/02/14 19:53:15 / 추천 0

language파일에서 문제가 생긴 것 같습니다.

케케케 / 2013/02/15 10:05:00 / 추천 0
// 웅파님 해결했습니다 ㅋㅋ
3일동안 계속 이것만 붙잡앗는데
이유가 sha1을쓰면 대충봐도 50자는 넘는데
제가 db에 패스워드필드를
varchar(20)으로해서..20글자만 나오니 당연히 인식이안된거.;ㅋㅋㅋㅋㅋㅋ

아오 어이업다는 ㅠ