Jump to content

Logout on the page the user is on


DeanWhitehouse

Recommended Posts

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.


//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.
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.