need a little php code i forgot

Discussion in 'Programming' started by mybluehair, Oct 1, 2007.

  1. #1
    im making a "login on index page" hack for a small forum system. basicly im copying the code from login.php, to the index page, but i need a code that will not display it if the person is already loged in. does anyone know what to put? please reply
     
    mybluehair, Oct 1, 2007 IP
  2. litebulb1

    litebulb1 Peon

    Messages:
    151
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    your forum login page should already have that.
     
    litebulb1, Oct 1, 2007 IP
  3. mybluehair

    mybluehair Peon

    Messages:
    1,374
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #3
    im doing this for my own forum SYSTEM. there xmb, phpbb, well, i have one of my own, and i need to make that hack
     
    mybluehair, Oct 2, 2007 IP
  4. Mr.A

    Mr.A Banned

    Messages:
    509
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Which forum board u r using??
     
    Mr.A, Oct 3, 2007 IP
  5. pixel_boost

    pixel_boost Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    At the top of the page you should put a $loggedIn variable which is initially false. After the user successfully logs in you set that var to true. This way you can hide or show your login form in respect to the user login status.
    I hope it helps.
    ( I'm not a php guru so you probably should listen to other's opinions )
     
    pixel_boost, Oct 3, 2007 IP
  6. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Mr.A: as he said, it's a home built solution.

    mybluehair: it's pretty hard to help you really, but essentially you need to just add an if around your display code. That if will be something like:
    if ( ! $logged_in ) {
    // display the login form
    }
    now, how you determine whether a user is logged in or not we don't know, so that's pretty much all we can tell you...
     
    TwistMyArm, Oct 3, 2007 IP
  7. mybluehair

    mybluehair Peon

    Messages:
    1,374
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thank you, that helped.
     
    mybluehair, Oct 3, 2007 IP