b3njo Posted November 3, 2004 Share Posted November 3, 2004 hi all, is it possible to have a new session each time a user refresh the page? here's the code i'm using right now, but it doesnt work: <?php session_start(); $_SESSION['sid'] = session_id(); ?> html : <body> <?php echo $_SESSION['sid']; unset($_SESSION['sid']); ?> </body> What is wrong with my code? :blush: Link to comment Share on other sites More sharing options...
0 Endoscient Posted November 3, 2004 Share Posted November 3, 2004 the problem with your code is that you are just unsetting a normal variable that u happen to set as the session id. I dont get what you are trying to do with this anyway... that defeats the point of a session. if u want a new session id jsut do this <?php session_regenerate_id(); ?> Link to comment Share on other sites More sharing options...
0 chuayw2000 Posted November 3, 2004 Share Posted November 3, 2004 Did u output anything before session_start? The script needs to send a cookie to initialise the session. Link to comment Share on other sites More sharing options...
0 Guest Posted November 4, 2004 Share Posted November 4, 2004 you kinda defeating the whole point of sessions lol - just overwrite them to NULL Link to comment Share on other sites More sharing options...
Question
b3njo
hi all, is it possible to have a new session each time a user refresh the page? here's the code i'm using right now, but it doesnt work:
html :
What is wrong with my code? :blush:
Link to comment
Share on other sites
3 answers to this question
Recommended Posts