Re: [PHP-DB] session_destroy();
Hi, I've been struggling with the same problem. The following code will destroy the session information and remove the cookie session_start(); $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); However my problem is that if I recreate the session in the same script the session file is created with exactly the same file name and creation time. Making me believe that the session is held in cache somewhere graeme. Chris Payne wrote: Hi there everyone, I need to destroy a session in the browser so when they log out it clears all the session data from the browser, I have tried: session_destroy(); But it doesnt seem to do it as the browser keeps the same PHPSessionID. What is the best way to destroy a session and generate a new sessionid without having to close the browser and go back again? Chris --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.791 / Virus Database: 535 - Release Date: 11/8/2004 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] session_destroy();
session_regenerate_id is what you're looking for http://us2.php.net/manual/en/function.session-regenerate-id.php Note that it keeps the session data, so you still need to session_destroy if you want to purge the data. - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 12:00 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] session_destroy(); Hi there everyone, I need to destroy a session in the browser so when they log out it clears all the session data from the browser, I have tried: session_destroy(); But it doesn't seem to do it as the browser keeps the same PHPSessionID. What is the best way to destroy a session and generate a new sessionid without having to close the browser and go back again? Chris --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.791 / Virus Database: 535 - Release Date: 11/8/2004 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] session_destroy();
Hi there everyone, I need to destroy a session in the browser so when they log out it clears all the session data from the browser, I have tried: session_destroy(); But it doesnt seem to do it as the browser keeps the same PHPSessionID. What is the best way to destroy a session and generate a new sessionid without having to close the browser and go back again? Chris --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.791 / Virus Database: 535 - Release Date: 11/8/2004
Re: [PHP-DB] session_destroy();
On Tue, 9 Nov 2004 01:00:12 -0500, Chris Payne [EMAIL PROTECTED] wrote: Hi there everyone, I need to destroy a session in the browser so when they log out it clears all the session data from the browser, I have tried: session_destroy(); But it doesn't seem to do it as the browser keeps the same PHPSessionID. What is the best way to destroy a session and generate a new sessionid without having to close the browser and go back again? Did you unset the session variables using: // Unset all of the session variables. $_SESSION = array(); If you are using a cookie for the session id, you might also want to delete the cookies if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } Do these before calling session_destroy. check it out here. http://www.php.net/session_destroy HTH -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] session_destroy(); on submit?
hello, will the following work or should i be attempting something else? /form input type=submit name=submit value=Submit onClick=?session_unset();,session_destroy();? input type=hidden name=url value=http://www.etc.com; thank you and best, addison -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session_destroy(); on submit?
on 1/21/03 9:19 PM, Addison Ellis at [EMAIL PROTECTED] appended the following bits to my mbox: hello, will the following work or should i be attempting something else? /form input type=submit name=submit value=Submit onClick=?session_unset();,session_destroy();? input type=hidden name=url value=http://www.etc.com; thank you and best, addison No, it will not work. PHP is server side, JavaScript (onClick, etc.) is client side. Have the form submit to a PHP page that has the session functions at the top. HTH. Sincerely, Paul Burney http://paulburney.com/ Q: Tired of creating admin interfaces to your MySQL web applications? A: Use MySTRI instead. http://www.burney.ws/software/mystri/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] session_destroy() problem.
Ok. What is the best way to destroy a session. I have a logout page which is supposed to destroy the session but it doesn't seem to be working. After the user logs out they are take back to the log in page, which is all fine and good. But if the user tries to go to a restricted page they are let in. This is the code for my logout page. session_start(); setcookie(session_name(),,,/); session_unset(); session_destroy(); header(Location: index.php); any ideas? //Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php