Yii Framework Forum: Persistent Session Thru Cookie Not Acting Like It Is Supposed To? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Persistent Session Thru Cookie Not Acting Like It Is Supposed To? Rate Topic: -----

#1 User is offline   nfdevil 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-December 12

Posted 13 January 2013 - 06:34 PM

Hello,
I'm still messing around with persitent logins.
I've got my DbHttpSession working now and it saves data to a cookie because I use Yii::app()->user->login($identity,86400); and allowAutoLogin to true. Though, every time I login, close my browser and then go to the page again, it creates a new session id, which makes a new row in my sessions table. This causes my database to fill up pretty fast if people go around and close their browser alot and go back to the site.
Is there a save way to make it use the same session id?
I'm checking Invision Power Board's code for the solution they use and discovered it stores a hash it saves in the member table to a cookie and checks this when the the user returns, then gives the user his old sessionid back.
Is this a safe way?

Also, is this normal behaviour? That the cookie doesn't give the user their old session back as long as it's lifetime isn't past? According to some guys in IRC, it should not be doing that.

Thanks in advance and hope someone can shed some light to my mystery,

And before I forget, cudos for the magnificent framework :) really fun to code in!

nfdevil
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users