Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2007
    Location
    UK
    Posts
    151
    Thanks
    9
    Thanked 2 Times in 2 Posts

    Hiding an area if session exists

    Hey,

    How do you hide an area of a page if a session exists? e.g. on home page if the user is logged in the login box does not show.

    Thanks

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    PHP Code:
    if(empty($_SESSION['logged_in']))
    {
        
    // login box
    }
    // else 
    Change logged_in to your session variable you want to compare. You could also use session_is_registered(), but that won't check the value, just see if the variable has been set.


  •  

    Posting Permissions

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