Jump to content

logout session message


mdmartiny

Recommended Posts

I was wondering if there is away to set a logout message when you are using sessions

 

this is my code

<?php
     session_start();
      if($_SESSION[auth] = "yes") {
      session_unset(); 
      session_destroy();
       header( "Location: index.php" );
      exit();
     } else { 
       if ($_SESSION[auth] != "yes") {
       header( "Location: index.php" );
   $_SESSION['error'] = "please login!";
      exit();
    }
  }
?>

Link to comment
https://forums.phpfreaks.com/topic/227840-logout-session-message/
Share on other sites

Here is the bit of code I use on my website to log people out....

 

<?php 
session_start();

$user_name = $_SESSION['username'];
$dbid = $_SESSION['userid']; ?>
<script type='text/javascript'>
function redirect(){
window.location = "index.php";
}
</script>
<?php

if ($user_name){
	session_destroy();
	echo "<body onLoad=\"setTimeout('redirect();', 1);\">";
                                 echo""<b>You hve been logged out...</b>;
}
else


?>

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.