JJohnsenDK Posted February 9, 2007 Share Posted February 9, 2007 Why doesnt this script register a session in tmp path? <? session_start(); if(isset($destroy)) { session_destroy(); unset($name); } else { if(!session_is_registered("name")) { session_register("name"); $name = "Spike"; } } ?> <p>SESSID: <?=$PHPSESSID;?> <p>Navn: <?=$_SESSION['name'];?> <form action="session2.php" method="post"> <input type="submit" name="reload" value="Genstart session"><br> <input type="submit" name="destroy" value="Stop session"> </form> Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted February 9, 2007 Share Posted February 9, 2007 <? session_start(); if(isset($destroy)) { session_unset(); session_destroy(); } else { if(!is_set($_SESSION['name'])) { $_SESSION['name'] = "Spike"; } } ?> <p>SESSID: <?php echo session_id(); ?> <p>Navn: <?php echo $_SESSION['name'];?> <form action="session2.php" method="post"> <input type="submit" name="reload" value="Genstart session"><br> <input type="submit" name="destroy" value="Stop session"> </form> short tags for php should be banned!!!! Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 9, 2007 Share Posted February 9, 2007 From the PHP Manual: If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister(). So, try this instead: <?php session_start(); if(isset($destroy)) { session_destroy(); unset($_SESSION['name']); } else { if(!isset($_SESSION['name'])) { $_SESSION['name'] = "Spike"; } } ?> Quote Link to comment Share on other sites More sharing options...
JJohnsenDK Posted February 9, 2007 Author Share Posted February 9, 2007 thanks mates Quote Link to comment Share on other sites More sharing options...
camdagr81 Posted February 9, 2007 Share Posted February 9, 2007 Yeah, you have to send a variable to the session in order for it to truely exsist: $_SESSION['var'] = 'value'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.