DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 I have a logout script <?php require_once ""$_SERVER[REQUEST_URI])""; session_destroy(); ?> but that one doesn't work, how can i log them out on the same page they came from Link to comment https://forums.phpfreaks.com/topic/102213-logout-on-the-page-the-user-is-on/ Share on other sites More sharing options...
BobcatM Posted April 21, 2008 Share Posted April 21, 2008 Do not understand the last part of the sentance. Log them out the same page they came from? Create a page logout.php <? session_start(); session_destroy(); ?> Logout Successful. Hope that helps. Link to comment https://forums.phpfreaks.com/topic/102213-logout-on-the-page-the-user-is-on/#findComment-523224 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Author Share Posted April 21, 2008 wot i ment, was so when they log out they go to the page they where just on before they clicked logout Link to comment https://forums.phpfreaks.com/topic/102213-logout-on-the-page-the-user-is-on/#findComment-523235 Share on other sites More sharing options...
BobcatM Posted April 21, 2008 Share Posted April 21, 2008 I use java to redirect them when I want. <SCRIPT language="JavaScript"> var count=3; function redirect() { window.location="index.php"; } function doCount() { if (count>1) { count-- } window.status=count + " seconds till redirection!"; setTimeout('doCount()',1000); } </SCRIPT> <SCRIPT language="JavaScript"> doCount(); setTimeout('redirect()',3000); </SCRIPT> Just change the index.php to whatever you want them to go to, along with the time to be directed. wot i ment, Still do not understand? Hope this helps. Link to comment https://forums.phpfreaks.com/topic/102213-logout-on-the-page-the-user-is-on/#findComment-523244 Share on other sites More sharing options...
doni49 Posted April 21, 2008 Share Posted April 21, 2008 //first we log them out if need be if ($_GET['cmd']=='logout'){ $_SESSION = array(); session_destroy(): setcookie('PHPSESSID', '', time()-3600, '/', '', 0,0); } //now we check to see if they're logged in. if (isset($_SESSION['user']))( echo "You're logged in"; //include a link that will log them out. echo '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=logout"'; }else{ //display page as though they're not logged in. } Link to comment https://forums.phpfreaks.com/topic/102213-logout-on-the-page-the-user-is-on/#findComment-523261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.