This is a discussion on Can't fully destroy session. Help! within the PHP General forums, part of the PHP Programming Forums category; I'm finishing an e-commerce site, but I've run into a problem destroying a session at the end ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm finishing an e-commerce site, but I've run into a problem destroying a
session at the end of a transaction. The code I'm using, taken from a text book, is: session_start(); session_unset(); session_destroy(); if( isset($HTTP_COOKIE_VARS[session_name()]) ) unset( $HTTP_COOKIE_VARS[session_name()] ); Now, I've tried updating this to: session_start(); session_unset(); session_destroy(); if( isset($_COOKIE[session_name()]) ) unset( $_COOKIE[session_name()] ); but the problem is the same: The problem is that when I go back to my homepage (using the same browser) the shopping from the previous session is still in the cart. I've tried placing phpinfo(); after the code above, and each time it tells me that for HTTP_COOKIE, PHPSESSID=7cdb552e41b9ba6d293ffcead527530f (or whatever my session was.) ie. PHPSESSID still exists after the session has been destroyed using session_destroy(). Is the PHPSESSID cookie the problem here? ie. the current session is being destroyed, but when I use session_start() at the top of the next page, is the previous session recalled using the PHPSESSID cookie? I'd be very grateful if someone can offer a solution to this problem, please. I've been trying to solve this for several hours and would appreciate your help. Thanks in advance! |