In the finished code I am getting a similar error. If I log in with false name and password, I get the error 'Undefined index: userid'. The alternative code (in madmins.php) should be:
function verifyUser($u,$pw){
$this->db->select('id,username');
$this->db->where('username',db_clean($u,16));
$this->db->where('password',($pw));
$this->db->where('status', 'active');
$this->db->limit(1);
$Q = $this->db->get('admins');
if ($Q->num_rows() > 0)
{
$row = $Q->row_array();
$_SESSION['userid'] = $row['id'];
$_SESSION['username'] = $row['username'];
}
else
{
$_SESSION['userid'] = 0;
$this->session->set_flashdata('error', 'Sorry, your username or password is incorrect!');
}
}[u]</u>
|