I want to change timeout for sessions. I set the timeout 1 second.
whenever I sign in to system , I can use the signout service after even a minute, while it's just for logged-in users.
Note : I write my own code for sign in and sign out.
here is my code for signin and signout service :
public function actionSignin()
{
$model= new Users();
$model->scenario ="signin";
if(isset($_POST['Users']))
{
$model->attributes=$_POST['Users'];
$model->validate();
if($model->hasErrors()){
if($model->hasErrors("username"))
$result=array("status"=>$model->getError("username"));
else if($model->hasErrors("password"))
$result=array("status"=>$model->getError("password"));
}else{
$user = $model->get_user();
$result['user'] = $user;
//// creating session
$session=new CHttpSession;
$session->open();
$session['name']=$user['username'];
$result=array("status"=>ErrorManager::get("OK");
}
}else{
$result=array("status"=>ErrorManager::get("no_data_submitted"));
}
$this->renderPartial("/print_result",array("result"=>$result,));
}
public function actionSignout(){
$session=new CHttpSession;
if(isset($session['name']))
{
$result = array("status"=>ErrorManager::get("OK"));
$session->destroy();
$this->renderPartial("/print_result",array("result"=>$result);
}
}
and there is session configuration in my config file (main.php) :
'components'=>array(
'session' => array (
'class'=>'CHttpSession',
'cookieMode' => 'allow',
'timeout' => 1
),
Please tell me What the problem is...