Codeigniter 3表格后显示30​​3状态代码

时间:2017-03-06 07:51:37

标签: codeigniter

我将CI版本2更改为3.但是我在登录时看到303在表单帖子上看到其他错误。为什么我收到此错误?然后我需要改变什么?我尝试了所有方法,但我无法登录。你能帮助我任何人吗?

然后我试着跟随:

$config['compress_output'] = FALSE; or $config['compress_output'] = TRUE;

这是我的表单提交功能:

    function __construct(){
    parent::__construct();
    $this->load->helper(array('cookie','date','form'));
    $this->load->library(array('encrypt','form_validation'));       
    $this->load->model(array('admin_model','user_model'));
    }
    public function admin_login(){
    $this->form_validation->set_rules('admin_name', 'Username', 'required');
    $this->form_validation->set_rules('admin_password', 'Password', 'required');
    if ($this->form_validation->run() === FALSE)
    {
        $this->load->view('admin/templates/login.php',$this->data);
    }else {
        $name = $this->input->post('admin_name');
        $pwd = md5($this->input->post('admin_password'));
        $mode = SUBADMIN;

        if ($name == $this->config->item('admin_name')){
            $mode = ADMIN;
        }
        $condition = array('admin_name' => $name, 'admin_password' => $pwd, 'is_verified' => 'Yes', 'status' => 'Active');
        $query = $this->admin_model->get_all_details($mode,$condition);
        //echo $this->db->last_query();die;
        if ($query->num_rows() == 1)
        {

            $priv = unserialize($query->row()->privileges);
            //print_r($priv);die;
            $admindata = array(
                            'fc_session_admin_id' => $query->row()->id,
                            'fc_session_admin_name' => $query->row()->admin_name,
                            'fc_session_admin_rep_code' => $query->row()->admin_rep_code,
                            'fc_session_admin_email' => $query->row()->email,
                            'session_admin_mode' => $mode,
                            'fc_session_admin_privileges' => $priv
                        );
            $this->session->set_userdata($admindata);
            $datestring = "%Y-%m-%d %h:%i:%s";
            $time = time();
            $_SESSION['last_login_date']= mdate($datestring,$time);
            $newdata = array(
               'last_login_date' => mdate($datestring,$time),
               'last_login_ip' => $this->input->ip_address()
            );
            $condition = array('id' => $query->row()->id);
            $this->admin_model->update_details($mode,$newdata,$condition);
            if ($this->input->post('remember') != ''){
                $adminid = $this->encrypt->encode($query->row()->id);
                $cookie = array(
                    'name'   => 'admin_session',
                    'value'  => $adminid,
                    'expire' => 86400,
                    'secure' => FALSE
                );

                $this->input->set_cookie($cookie); 
            }
            $this->admin_model->urlAdminResponse($query->row()->email);
            $this->setErrorMessage('success','Login Success');
            redirect('admin/dashboard');

        }else {
            $this->setErrorMessage('error','Invalid Login Details');
        }
        redirect('admin');
    }
}

1 个答案:

答案 0 :(得分:1)

会话库已在CodeIgniter 3中完全重写,现在附带了许多新功能,但这也意味着您应该进行更改。

阅读 第6步:更新会话库使用情况 从 https://www.codeigniter.com/user_guide/installation/upgrade_300.html