Vigilant Psyche Posted March 22, 2008 Share Posted March 22, 2008 OK I managed to fix the signing in bit but now im stuck with signing out. I link to this page which should unset the variable $_SESSION["CURRENT_USER"] the link back to the original page works but when i get back there and echo the variable it is still set... here's the code: <html> <?php $refresh=$_GET['ref']; echo("<meta http-equiv=\"refresh\" content=\"0;url=http://www.mysite.com\">"); unset($_SESSION["CURRENT_USER"]); ?> </html> Link to comment https://forums.phpfreaks.com/topic/97415-signing-out/ Share on other sites More sharing options...
pocobueno1388 Posted March 22, 2008 Share Posted March 22, 2008 Try to unset the session before you redirect. You could also use session_destroy() instead to destroy all sessions. Link to comment https://forums.phpfreaks.com/topic/97415-signing-out/#findComment-498451 Share on other sites More sharing options...
Goldeneye Posted March 22, 2008 Share Posted March 22, 2008 Try this <?php session_start(); session_destroy(); header('location: http://www.mysite.com'); ?> That should work, though I don't know what the $refresh variable is for. I'm guessing redirecting back to the referring url.. but anyways, that's a pretty easy way to 'sign out.' Link to comment https://forums.phpfreaks.com/topic/97415-signing-out/#findComment-498455 Share on other sites More sharing options...
cooldude832 Posted March 22, 2008 Share Posted March 22, 2008 don't use session_destroy() its the equivalent of deleting all your cookies for a single server! Instead target the session u want <?php session_start(); $_SESSION['CURRENT_USER'] = ""; die(header("location: index.php")); ?> Link to comment https://forums.phpfreaks.com/topic/97415-signing-out/#findComment-498474 Share on other sites More sharing options...
Trium918 Posted March 22, 2008 Share Posted March 22, 2008 don't use session_destroy() its the equivalent of deleting all your cookies for a single server! Instead target the session u want <?php session_start(); $_SESSION['CURRENT_USER'] = ""; die(header("location: index.php")); ?> So what would this equal to? <?php $_SESSION[''] ?> Link to comment https://forums.phpfreaks.com/topic/97415-signing-out/#findComment-498480 Share on other sites More sharing options...
cooldude832 Posted March 22, 2008 Share Posted March 22, 2008 it be invalid syntax because you can't have an empty array key Link to comment https://forums.phpfreaks.com/topic/97415-signing-out/#findComment-498481 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.