douping4436 2017-10-18 08:37
浏览 47

Codeigniter将错误重定向到404

Okay, trying to get a CMS web panel loaded but not sure what is happening. I log in and after the script checks the database for login info, it tries to redirect to the dashboard page. It loads a 404 not found page instead of what it should be loading. This snippet comes from the admin-login.php in the /application/views directory.

// 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.
}

I am brand new to codeigniter so pardon my ignorance in this. What is it redirecting to? I see a couple different admin.php files in different folders as well as a few dashboard.php files also in different folders. I guess I am just at a loss where to begin to look for the problem. I am using apache rewrite enabled and a .htaccess file with rewrite lines. I was also told that this script needs PHP 7.0 which I have as well as php 7.1 and mysql 5.7 for the database.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)