Jump to content

Session Basics


neridaj

Recommended Posts

Hello,

 

I'm just learning about sessions and want to control access to inner pages of a website i.e., restricting access based on whether or not a user is logged in, and also why my sessions never seem to time out.

 

something like this, but this always calls display_folders()

 

if ($username && $passwd)
// they have just tried logging in
{
  try
  {
    display_folder();
    // if they are in the database register the user id
    $_SESSION['valid_user'] = $username;
  }
  catch(Exception $e)
  {
    // unsuccessful login
    do_html_header('Problem:');
    echo 'You could not be logged in. 
          You must be logged in to view this page.';
    do_html_url('login.php', 'Login');
    do_html_footer();
    exit;
  }      
}

 

 

Thanks for any insight,

 

Jason

Link to comment
https://forums.phpfreaks.com/topic/101508-session-basics/
Share on other sites

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.