<?
    $aUserDatabase
["digiways"] = md5("cool");
    
// Same header to start the session and use it's variables
    
session_start(); // starting session
    // session variables must be global
    
global $strName$hashPassword$sessData;
    
// registering session variables
    
session_register("strName");
    
session_register("hashPassword");
    
session_register("sessData");

    
// checking if user is not authenticated
    
if (!isset($strName) || $aUserDatabase[$strName] != $hashPassword)
    {
        
// redirecting user to the login page
        
header("Location: http://www.digiways.com/articles/php/sessauth/login.php");
        exit;
    }
?>
    Checking session variable:<br>
<?
    
echo "You authorized at ".date("D M j G:i:s T Y"$sessData["time"])."<br>";
?>    
    Links to other pages which will share this session.<br>
    <a href="login.php?<?=SID;?>">login.php</a><br>
    <a href="logout.php?<?=SID;?>">logout.php</a>