note 108015 added to function.session-id

From: Date: Thu, 22 Mar 2012 11:43:07 +0000
Subject: note 108015 added to function.session-id
Groups: php.notes 
Request: Send a blank email to php-notes+get-186771@lists.php.net to get a copy of this message
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. ---- Server IP: 195.221.21.36 Probable Submitter: 87.231.162.78 ---- Manual Page -- http://www.php.net/manual/en/function.session-id.php Edit -- https://master.php.net/note/edit/108015 Del: integrated -- https://master.php.net/note/delete/108015/integrated Del: useless -- https://master.php.net/note/delete/108015/useless Del: bad code -- https://master.php.net/note/delete/108015/bad+code Del: spam -- https://master.php.net/note/delete/108015/spam Del: non-english -- https://master.php.net/note/delete/108015/non-english Del: in docs -- https://master.php.net/note/delete/108015/in+docs Del: other reasons-- https://master.php.net/note/delete/108015 Reject -- https://master.php.net/note/reject/108015 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186771) next »