Codeigniter: doğrulama sorunu

0 Cevap php

Kullanıcı herhangi bir şifre ile giriş yapabilirsiniz nedense, önce ben şifre kontrol unuttum ama öyle değil ... ve ben sadece cant sorunu bulmak düşündüm

burada model:

/*#######################################################*/
    function validate()
/*#######################################################*/
    {
        $this->db->where('username', $this->input->post('username'));
        $this->db->where('password', md5($this->input->post('password')));
        $q = $this->db->get('user_extra');

        if($q->num_rows() == 1):
            return true;
        else:
            return false;
        endif;
    }//end of function validate()

Kontrolör

/*#######################################################*/
        function validate_credentials()
/*#######################################################*/
        {
            $this->load->model('membership_model');

            $this->load->library('form_validation');

            $this->form_validation->set_rules('username', 'Name', 'trim|required');
            $this->form_validation->set_rules('password', 'password', 'trim|required');
            if(!$this->membership_model->validate()):
                $this->form_validation->set_message('check_login', 'Login not correct, please try again.');
            endif;

            if($this->form_validation->run() == FALSE):
                $this->index();
            else:
                $this->membership_model->userinfo($this->input->post('username'));
                //should redirect to last view
                redirect($this->session->flashdata('redirect_url'));
            endif;
        }// end of validate_credentials()

0 Cevap