How to retain the session id if the cookie containing the session_id is deleted?
I was reading about cookie and session's rela开发者_Python百科tivity, and a question prompted into my mind as
How to retain the session id if the cookie containing the session_id is deleted?
So guide me in this case..
Thanks In Advance...
You could store ip->session relation in a table and reference it (stored sessions database), but I would advise against that for multiple reasons (including if you log in at an internet cafe and another user on the same network accesses the page, they now "own" the other user's session).
The other options is to apply SESSID in the URL and every link contain that key, but that forces the URL to carry the ID everywhere.
Short answer, have them re-authenticate and create a new session; it's safer that way.
The short answer is you don't.
The longer answer is you're basically stuck here. If the cookie is the only way you keep the session id around, then deleting the cookie means the session id is lost forever from the client's end. You can, if you still know the session id, propagate it through URLs or recreate the cookie, but then you'll want to beware of things like session fixation.
hi I give short answer.A cookie create a file in local pc and session could not create file it create a array so the browser has delete then the session has been deleted but the cookie has no delete and in a cyber cafe one local pc use many .
精彩评论