[eluser]GamingFusion[/eluser]
ok something is wrong im being redirected to the home page but none of the variables work
Code:
function login()
{
$this->load->helper('cookie');
$username = $this->input->post('username');
$password = $this->input->post('password');
$checkUser = $this->db->get_where('users', array('username' => $username, 'password' => $password));
if ($checkUser->num_rows() < 1) {
echo 'Password is incorrect.';
echo $password;
}else{
$cookie = array(
'username' => $username,
'passdword' => $password,
);
set_cookie($cookie);
redirect('theater', 'refresh');
}
}
the login page directs me to the home like it should if the variables have values
heres the checkLogin() function
Code:
function checkLogin()
{
$this->load->helper('cookie');
$u1 = get_cookie('username');
$p1 = get_cookie('password');
$logged = $this->db->get_where('users', array ('username' => $u1, 'password' => $p1));
if($logged->num_rows() >0)
{
$row = $logged->row();
$uId = $row->id;
$uName = $row->username;
$data['uId'] = $uId;
$data['uName'] = $uName;
echo $u1;
return $row;
}
}
what i changed in here was
$query = $this->db->get_where('users', array ('username' => $u1, 'password' => $p1));
to
$logged = $this->db->get_where('users', array ('username' => $u1, 'password' => $p1));