I need PHP script in orde to disappear Login and Register button when a user logs in

Discussion in 'PHP' started by JoshuaReen, Sep 3, 2012.

  1. #1
    I have developed a website with a Signup and Login page. I tried to register and then login and I was successful. But there is still one more thing to do, which I can't do. I need help, to disappear the Register and Login button from menu when I login, and a Logout button should appear. When I logout, then the Logout button should disappear and the Register and login button should appear. I haven't tried yet to create the script because I can do it. Please help me how to acquire these requirements?
    Thanks in advance...
     
    JoshuaReen, Sep 3, 2012 IP
  2. Gemba

    Gemba Member

    Messages:
    36
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    25
    #2
    How are you tracking whether or not they logged in?
    If it's a session or cookie, just do an if statement where the buttons are.

    Example
    <?php 
    if (isset($_SESSION['id'])) { //logged in, show logout button
    echo 'Logout Button HTML';
    } else {
    echo 'Login and Signup Button HTML';
    }
    PHP:
     
    Gemba, Sep 3, 2012 IP