Session Setting

Hi every one;

how to i setting session in YII , when user close the Browser the session related to that user cleaned?

i setting session to be saved in my project.




'session'=>array('autoStart'=>true, 'savePath'=>$path )



please help me .Thanks

http://www.yiiframework.com/forum/index.php/topic/12124-how-to-implement-session-timeout/page__p__59441#entry59441 - use this method and put timeout = 0

I can’t find any solution in this Topic …!

Please help me clearly.


'session'=>array('autoStart'=>true, 'savePath'=>$path )

to


'session' => array('class' => 'CDbHttpSession', 'autoStart'=>true, 'savePath'=>$path, 'timeout' => 0)



Thanks for Your try. but session file not be created; and i not have session in my other web page.and i have session for a moment.

please help me? :rolleyes:

Hmmm. Then you should use cookies instead of session. Becouse session can’t be destroyed when user closes browser.


'allowAutoLogin'=>true,

and


Yii::app()->user->login($identity, 0);

no no the data that be saved in session is important.not safe if i save them into client side.

It’s impossible. Becouse you can’t check on your server if user closed browser. Read about sessions and cookies. Cookies can be safe.

But cookie be save in user side.it can be accessible ;

Thank you . :rolleyes: :rolleyes:

For example: create some token (some radom encoded string) and save it in cookie of user and in DB. And I think it will be hard to guess this random string and to fake the authorization.

Thanks. if change session setting according the below code when i close the Browser the session be destroied.but i can’t see the session’S in session folder in my project.

before this setting i could see the session files and open them.why???? :) :) :) :)





'session'=>array(

		 'class' => 'CDbHttpSession',

		 'autoStart'=>true, 

		 'savePath'=>$path,

                  /*'timeout' =>0,*/

		 

		 )



right here


'class' => 'CDbHttpSession', 

it says store the sessions in database thats why you can’t find the session file

Thanks for reply.but i don’t save them in DB and that work…??? :rolleyes: