Hi All,
I am working with session variable.
I have created session variable in Site controller
as like
public function authenticate()
{
$user=UserSignupForm::model()->findByAttributes(array('emailid'=>$this->username));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if ($user->password!==($this->password))
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$connection=Yii::app()->db;
$sql="select rolename from rolesinfo where roleid IN (select roleid from userroles where userid IN (select userid from userinfo where emailid='$user->emailid')) ";
$command = $connection->createCommand($sql);
$roles = $command->queryAll();
// $this->setState(‘roles’,$roles[‘0’][‘rolename’]);
// $this->setState(‘user’, $user->username);
$this->errorCode=self::ERROR_NONE;
Yii::app()->session['role1']=$roles['0']['rolename'];
$s=Yii::app()->session['role1'];
}
I am getting value for variable $s.
But I redirected to another controller. Its session variable not retained and its get destory.
Please suggest any idea.