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.

Link to comment
Share on other sites


//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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.