SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot iStudent's Avatar
    Join Date
    Mar 2004
    Location
    So Cal
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to make page require a session variable?

    How to make page require a session variable?

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    say you wanna check if $_SESSION['userid'] does not exist then stop or redirect
    PHP Code:
    if(!isset($_SESSION['userid']) || (isset($_SESSIOn['userid'] && empty($_SESSION['userid']))
    {
      exit;
    //if you wanna stop loading page
      
    header('Location: otherpage.php');//redirect the page

    first condition checks if the variable is set and second checks if variable set then is it empty?

    hope it helps you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •