session related problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

session related problem

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post by renu »

i know that but that works only with php 4.3 or greater version.
wht else is the way.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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)
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

which didn't work? I suggested 2 directions.
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post by renu »

i tried both.i deleted the cookies and by my function generated new session id.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

post some code, I know both work, normally.
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
renu
Forum Commoner
Posts: 30
Joined: Sat Nov 06, 2004 12:20 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply