[eluser]_SC_[/eluser]
Hi all,
I have some troubles with $_SESSION.
In my controller I have :
Code:
$this-> MAdmins-> verifyUser($u,$pw);
if ($_SESSION['userid'] > 0){
redirect('admin/dashboard','refresh');
}
In my module I have:
Code:
function verifyUser($u,$pw){
...
$Q = $this-> db-> get('admins');
if ($Q-> num_rows() > 0){
$row = $Q-> row_array();
$_SESSION['userid'] = $row['id'];
$_SESSION['username'] = $row['username'];
}else{
$this-> session-> set_flashdata('error', 'Sorry, your username or password is incorrect!');
}
}
But if I I insert the incorrect data, when i return at the controller in the row :
Quote:if ($_SESSION['userid'] > 0) ...
I get an error:
Message: Undefined index: userid
How I can fix this?
Another problem is : why i dont get the messange set in flashdata?
how set_flashdata works? When you print the message? Inside the module or into the controller when you use the $_SESSION object?