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.