[eluser]Escee[/eluser]
&uot;[quote author="Derek Allard" date=;1193695204"]Welcome to CI Escee. I hope after this gets resolved for you we see you around a lot more
Can you post some relevant chunks of your model so we can see how you are using the session?[/quote]
Okay, for example, here is the constructor of the 'member' model which checks if a user is already logged in:
Code:
public function Member ( )
{
parent::Model ( );
// If the session 'userid' exists get the username
$userdata = $this -> session -> userdata ( 'userid' );
if ( $userdata !== false && ctype_digit ( $userdata ) )
{
// Query for the username/id
$this -> db -> select ( 'id, username' );
$this -> db -> where ( 'id', $userdata );
$userquery = $this -> db -> get ( 'users' );
if ( $userquery -> num_rows ( ) == 1 )
{
// Save query recieved data
$userdata = $userquery -> row ( );
$this -> userid = $userdata -> id;
$this -> username = $userdata -> username;
$this -> loggedin = true;
}
}
}
And here's a bit of code for a new login:
Code:
public function ProcessLogin ( $username, $password )
{
// Get some data and check some stuff
// ...
// Login is ok
$this -> username = $userdata -> username;
$this -> userid = $userdata -> id;
$this -> session -> set_userdata ( 'userid', $userdata -> id ); // Set de userid session
$this -> loggedin = true;
return true;
}
When I first load the session library and then the member model in a controller, it works. But i'd like to autoload them both (the session library already does). But when I autoload them both, the member won't find/use/load/... the session library..
Hope you understand :-)
So far CodeIgniter rocks, great documentation, helps allot ;-)
Stefan