How to maintain user sessions and login log out sessions in pHP?

Discussion in 'PHP' started by shaibibutt, Sep 4, 2009.

  1. #1
    I m new to PHP and i want to learn the ways of maintaining the user sessions and login logout sessions in PHP. thanks :)
     
    shaibibutt, Sep 4, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To maintain the session, simply type session_start(); at the top of all your scripts..

    To login/logout, set a special session variable at login, for example $_SESSION['user_id'] = $row['user_id']; //from db, then check to see if the user is logged in or not based on whether that variable is empty.

    Anyway, there's probably loads of tutorials if you do a google search.
     
    premiumscripts, Sep 4, 2009 IP
  3. shaibibutt

    shaibibutt Member

    Messages:
    606
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #3
    Please suggest me some website resources if u know any
     
    shaibibutt, Sep 4, 2009 IP
  4. yuvrajm

    yuvrajm Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    w3schools is the best source!
     
    yuvrajm, Sep 4, 2009 IP
  5. shaibibutt

    shaibibutt Member

    Messages:
    606
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    35
    #5
    Thanks buddy ...
     
    shaibibutt, Sep 4, 2009 IP