Page 1 of 1
session related problem
Posted: Tue Jan 11, 2005 10:33 pm
by renu
hi
in my project after logging out if i relogin then session id doesn't change.it remains previous one.i have destroyed all session variables when logging out.After tht when i recreate the session then i dont get new session id.
can nyone tell how to generate new session id.
thanks
Posted: Tue Jan 11, 2005 10:55 pm
by feyd
Posted: Tue Jan 11, 2005 11:30 pm
by renu
i know that but that works only with php 4.3 or greater version.
wht else is the way.
Posted: Tue Jan 11, 2005 11:56 pm
by feyd
destroying the session cookie..
you could create your own session handler..
some research:
http://us3.php.net/manual/en/function.s ... andler.php
search through the forums for "session +handler" (leave the plus)
Posted: Wed Jan 12, 2005 12:19 am
by renu
that even didnt work.I used some logic to generate new session id.
but that is just changed on only that page.on another pages it remains prevoius one.i managed to change it on every page but then another session variables didnt come under this session.
Posted: Wed Jan 12, 2005 12:28 am
by feyd
which didn't work? I suggested 2 directions.
Posted: Wed Jan 12, 2005 12:48 am
by renu
i tried both.i deleted the cookies and by my function generated new session id.
Posted: Wed Jan 12, 2005 12:50 am
by feyd
post some code, I know both work, normally.
Posted: Wed Jan 12, 2005 1:05 am
by renu
i told u that from this id get changed but only on that page.on another pages it doesn't change.
tell me one thing if session is destroyed then after creating new session ,shoudnt it generate new session id.
Posted: Wed Jan 12, 2005 1:09 am
by feyd
if the browser passes no id, or an incorrect, or non-existant id, the id is typically generated..
In the case where the browser doesn't keep cookies, or you have trans_id on things get a little sticky.. as php will tweak your finalized html code to have the session id incorporated.
Why is there such an extreme need to create a new session id, when trashing the data hooked to the current one, effectively makes it a new one?
Posted: Wed Jan 12, 2005 1:22 am
by renu
I'm working on shopping cart project.When user logout and relogin again then i want new session id.as i'm maintaining user logs at admin end.if session id remains same then i cant get the information that that particular user has logined twice. Did u get me
Posted: Wed Jan 12, 2005 1:46 am
by feyd
okay.. try this:
create 2 scripts. One that does the initial creation of the first session id. And another that deletes it. On the second page do not start the session, just destroy the cookie. On the first page output the session id, place a link to the other page in each script.