I am working with a shopping cart application that uses the session_id to identify an order. When the order has been completed, is there a way to begin a new session? Essentially what I need to do is kill the old session_id and start a new one? I have tried using the session_regenerate_id() function, but it does not work on my version of PHP.
Thanks.
How do I kill the session and start a new one?
Moderator: General Moderators
-
andrewcarraway
- Forum Newbie
- Posts: 9
- Joined: Fri May 02, 2003 1:54 pm
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
What version of PHP are you running?
If you are using the superglobal $_SESSION[], try the following:
HTH
If you are using the superglobal $_SESSION[], try the following:
Code: Select all
<?php
session_start();
$_SESSION=array();
session_destroy();
// one of the following two, depending upon your settings
setcookie("SES_NAME","","","/");
setcookie(session_name(),"","","/");
?>-
andrewcarraway
- Forum Newbie
- Posts: 9
- Joined: Fri May 02, 2003 1:54 pm