Codeigniter将错误重定向到404

时间:2017-10-18 08:37:29

标签: php codeigniter

好的,尝试加载CMS网络面板但不确定发生了什么。我登录并在脚本检查数据库以获取登录信息后,它会尝试重定向到仪表板页面。它加载404未找到的页面而不是它应该加载的页面。此代码段来自/ application / views目录中的admin-login.php。

// Run the query

$query = $this->db->query("select * from adminlogin where binary username ='$username' and binary password = '$password'");
    // Let's check if there are any results
    if($query->num_rows == 1)
    {
        // If there is a user, then create session data
        //$row = $query->result_array();
        if($remember=='on' && $remember!=''){
            $cookie = array(
                'name'   => 'username-admin',
                'value'  => $username,
                'expire' => 86500
            );
            //  $this->ci->db->insert("UserCookies", array("CookieUserEmail"=>$userEmail, "CookieRandom"=>$randomString));
            $this->input->set_cookie($cookie);
            $this->input->cookie('username-admin', false);
        }

        $this->session->set_userdata('username-admin',$_POST['email']);
        $user = $this->session->userdata('username-admin');

        foreach($query->result_array() as $row){
            $this->session->set_userdata('role-admin',$row['role']);
        }

        $user1 = $this->session->userdata('role-admin');
        $this->db->select('B.rolename as rolename,A.role_id,A.page_id as pages');
        $this->db->from('role B');// I use aliasing make joins easier
        $this->db->join('role_permission A', ' B.r_id = A.role_id');
        $this->db->where('B.rolename',$user1);

        $query1 = $this->db->get();
        foreach($query1->result_array() as $row1){
            $this->session->set_userdata('permission',$row1['pages']);
        }

        $user2 = $this->session->userdata('permission');
        //return $row;
        //echo $user1;
        if($user2)
        {
            redirect('admin/dashboard');
        }
    }
    // If the previous process did not validate
    // then return false.
}

我是codeigniter的新手,所以请原谅我的无知。什么是重定向到?我在不同的文件夹中看到了几个不同的admin.php文件,以及一些也在不同文件夹中的dashboard.php文件。我想我只是不知所措从哪里开始寻找问题。我正在使用apache重写和一个带重写行的.htaccess文件。我还被告知这个脚本需要PHP 7.0,以及数据库的php 7.1和mysql 5.7。

0 个答案:

没有答案