note 108015 deleted from function.session-id by philip
| From: | philip@php.net | Date: | Thu, 22 Mar 2012 22:45:44 +0000 |
| Subject: | note 108015 deleted from function.session-id by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186777@lists.php.net to get a copy of this message | ||
Note Submitter: sir_bline at hotmail dot com
----
i have a strange effect if session_id() is set before session start and stocked into mysql database
with a hash
while session_start() is needed to create a new session id, if i create my own SID i can regenerate
id into cookies at all refreshes off the user, while the first id value stays into our database
(encrypted)
for exemple:
<?php
// set our session handler
session_set_save_handler('myPDO::open','myPDO::close','myPDO::read',
'myPDO::write','myPDO::destroy','myPDO::gc');
// SID does not exist so create it
if(session_id() == '')
Session_Id(uniqid('prefix_'.md5(mt_rand()).rand(microtime(),'10000')));
// launch session
session_start();
// set our cookie with the new id
setcookie('cookie_name',session_id(),time()+xxx,'/','domain@name',TRUE,TRUE);
?>
the consequence is that if our data base contain the encrypted id (i have it with sha1) the ID
column stays with its own value wether my session id into cookie value changes at all refreshes.