Re-initiating an autostarted session
| From: | Ville Mattila | Date: | Wed, 11 May 2005 18:32:07 +0000 |
| Subject: | Re-initiating an autostarted session | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-214963@lists.php.net to get a copy of this message | ||
Hi there,
I have some problems with PHP session handling. I have set to .htaccess file that PHP will start sessions and use cookies only automatically. Everything works fine until I need to re-initiate the session (give a new session ID and destroy the old one). For some reason, the old session id persists.
I use the following functions:
session_destroy();
session_regenerate_id();
session_write_close();
Header("Location: ...");
exit;
For my point of view, this should do exactly what I like to do: destroy the old session data, generate a new one, write them and redirect the user to next page.
I remember somehow that there have been problems with SetCookie and Header("Location: ..") combination. Could this session problem arise due same reasons?
Well, I'm happy to hear the fixes or workarounds. =)
Thanks,
Ville