destroying a session ID

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
User avatar
m@ndio
Forum Regular
Posts: 163
Joined: Fri Jun 06, 2003 12:09 pm
Location: UK

destroying a session ID

Post by m@ndio »

Hi,

I am trying to create a session, display the session ID and then close the session.

At the moment it creates the session, displays the session ID but when you refresh the page the session ID stays the same.. I want this ID to change! It should becuase I deleted the session?

Is there a fix for this? Please comment on how I have coded it, have I done this correctly? Any feedback is welcome.

I hope this makes sense.

Here is my code:

Code: Select all

session_start();

$_SESSION['test'] = session_id();

echo $_SESSION['test'];

$_SESSION['test'] = array();

session_destroy();
Galahad
Forum Contributor
Posts: 111
Joined: Fri Jun 14, 2002 5:50 pm

Post by Galahad »

Look at this post. delorian has a good post on destroying sessions.
Post Reply