Welcome Guest, Not a member yet? Register   Sign In
problems with $_SESSION
#1

[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?


Messages In This Thread
problems with $_SESSION - by El Forum - 01-09-2010, 12:45 PM
problems with $_SESSION - by El Forum - 01-09-2010, 12:55 PM
problems with $_SESSION - by El Forum - 01-09-2010, 01:01 PM
problems with $_SESSION - by El Forum - 01-09-2010, 01:07 PM
problems with $_SESSION - by El Forum - 01-09-2010, 01:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB