• 0

new session after every refresh?


Question

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

3 answers to this question

Recommended Posts

  • 0

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.