note 25615 added to function.session-destroy

From: Date: Mon, 30 Sep 2002 15:59:59 +0000
Subject: note 25615 added to function.session-destroy
Groups: php.notes 
Request: Send a blank email to php-notes+get-37429@lists.php.net to get a copy of this message
I have a problem registering unique session id's. I check my database to see if it exists already and if it does then create another session id but for some reason it stays the same as the one that already exists in the database that has just been used. Please help... <? /* * My source */ session_start(); $_SESSION['userInfo']['sess_id']=$PHPSESSID; $mysql=new mysql($host, $user, $password, $db, 0); // Starting up my connection using my class $mysql->query("SELECT * FROM $tblRegistrations WHERE session_id='" . $_SESSION['userInfo']['sess_id'] . "'"); // Checking just to make sure that session doesn't exist already in the database if($mysql->num_rows() > 0){ // If it does, then do this... unset($_SESSION); // Unset $_SESSION=array(); // Reset? $_SESSION['userInfo']['sess_id']=md5(uniqid(rand(),1)); // Attempting to register a new one but it keeps the one I just used } ?> -- http://www.php.net/manual/en/function.session-destroy.php http://master.php.net/manage/user-notes.php?action=edit+25615 http://master.php.net/manage/user-notes.php?action=delete+25615 http://master.php.net/manage/user-notes.php?action=reject+25615

« previous php.notes (#37429) next »