Forum Moderators: coopster

Message Too Old, No Replies

regenerate session_id

         

ikke

5:44 am on Apr 19, 2005 (gmt 0)

10+ Year Member



Goodmorning,

I have a session id that I use for an order to put in the database and also to get it out of the database. But when you place the order you have to close the browser so you get a new session_id. Because now it puts the items by the same session_id in the database and display al the the items of that session id. I want to generate a new session_id but I have not the option regenerate_session() because the hosting server dus not support that version of php. Someone has a idea to asign a new session_id to session_id()?

Thanks alot

[edited by: ikke at 6:08 am (utc) on April 19, 2005]

dmmh

5:59 am on Apr 19, 2005 (gmt 0)

10+ Year Member



I wouldnt know the answer to this one, but in my opinion you are making wrong decisions when you force people to close the browser in order for them to be able to make an order

just my 0.02

ikke

6:06 am on Apr 19, 2005 (gmt 0)

10+ Year Member



That`s right and that`s why I want to generate automatic a new session_id so they don`t have to close the browser.

ikke

6:27 am on Apr 19, 2005 (gmt 0)

10+ Year Member



I found this and its working very wel it does not regenerate the session id but only the id that`s insert in the database.


<?
function randomNumber () {
$length ="32"; // the length of the number required
$possible = '0123456789qwertyuiopasdfghjklzxcvbnm';
$str ="";
while (strlen($str) < $length) {
$str.=substr($possible, (rand() % strlen($possible)),1);
}
return($str);
}
$id=randomNumber();
?>

jatar_k

4:50 pm on Apr 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what about just destroying the existing session and then starting a new one?

ikke

4:19 am on Apr 20, 2005 (gmt 0)

10+ Year Member



I destroy him on the last page but only the data of the shoppng cart is empty and you don`t get a new session_id