Hi,
I am making a login script using cakephp.The check_login function from user model returns all data of the user if login succeed.
Inside the user controller if I just want to display
[code=php]echo $this -> Session -> read(“User.type”);
then nothing is displayed where as if I do
[code=php]$this->Session->write(‘type’, $user[‘User’][‘type’]);
echo $this->Session->read(“type”);
then it displays the data.
Code:
[code=php]if( ($user = $this->User->check_login($this->data)) )
{
$this->Session->write(‘type’, $user[‘User’][‘type’]);
echo $this->Session->read(“type”);
// save the user information to the session
$this->Session->write(‘User’, $user);
echo $this -> Session -> read(“User.type”); //display nothing
}
I have to know what I am doing wrong.
Please suggest..
Thanks,
Raj