|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-09-16 11:59 UTC] zoom at atlas dot sk
Description: ------------ I use following order of code after users log-in, to regenerate session id. session_start() ...checking values... ...assigning values into $_SESSION session_regenerate_id(true) ...inserting into database, date and IP of log event. session_commit() header() redirect into another page to show private content. ---- interesting thing is, that every time I run this script I get 2! inserts into database - as there were 2 logins occured. I use IE6 and FF and have also *random* problems with session_destroy() function. In debugging process I uncovered this above. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 00:00:02 2025 UTC |
here is sniplet of my code that should authentificate user, rewrite current session_id, assign some attribute to it and let him go to next page. // session_start() session_regenerate_id(true); $sql = "INSERT INTO logins VALUES ('{$log_date}','{$IP['addr']}')"; $db->query($sql); $_SESSION['userid'] = $uid; $link = "Location: http://" . $CONFIG['APP_HOST'] . "in/"; session_commit(); header($link); // expected behaviour 1. rewrite session id (I use cookies to propagate SID) and keep current attributes. 2. remove old session file from filesystem 3. insert 1 record into database 4. add new attribute into $_SESSION['uid'] 5. redirect user to new page // actual results 1. rewrite session id (cookie) and file 2. remove old session file (*randomly* error "Warning: session_regenerate_id() [function.session-regenerate-id]: Session object destruction failed in" occurs!) 3. 2 records are inserted into database (instead of one) 4. ok 5. if no error occured in point 2, then redirect is ok. Used system is WinXP - SP2 PHP5.1RC2 instaled in SAPI mode Apache 2.0.53 Clients used: IE6, Firefox1.0.6