How to unset user created sessions?

Hi

I’ve used the facebook connect to login in to my application.

I’ve rewritten the class to login using facebook and its working fine. I’ve overwritten the logout method as such


public function actionLogout()

{

Yii::app()->user->logout();

session_start();

session_destroy();		

$this->redirect(Yii::app()->homeUrl);

}

the user set by the login method is loggedout but the sessions i’ve created while logging in are not destroyed. so whenever i click the login it doesn’t go for the facebook to get credentials but just logging in automatically…

I created session like below,


Yii::app()->session['fbuid'] = $obj->fbuid;

How can i delete the sessions which i created?

session->remove()

There is the destroy() method - http://www.yiiframework.com/doc/api/1.1/CHttpSession#destroy-detail

Thanks for your answers. Actually that works but the main problem is the automatic expiration of sessions!!!

when the session of Yii::app()->user expires , the session set by me are still alive and it throws an exception where a function is written after checking the session set by me.

the code is like this,


if (isset(Yii::app()->session['mid'])){

// get all friends

$this->mfriends = $mUser->getFriends();  // this function in turn requires the session of Yii::app()->user

//this is where the exception is thrown...

}

I know that just calling a function without checking all the available session is a bad parctice , but i want to know why different session expire at different time?

Did you test with the user state too?




  Yii::app()->user->setState(...)


  Yii::app()->user->getState(...)


  if (Yii::app()->user->hasState(...))




See User setstate