How do I do a Keep Loged in part?

Discussion in 'PHP' started by FlexiHost, Jun 17, 2010.

  1. #1
    Our members are getting sick of having to log in every time they visit our site.

    What is the best way to do the keep logged in part?
     
    FlexiHost, Jun 17, 2010 IP
  2. Cozmic

    Cozmic Member

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #2
    Try using the setcookie function. Example:

    <?php
    setcookie($cookieName, $cookieValue, $expire);
    ?>
    PHP:
    You can retreive information from this with:

    
    $val = $_COOKIE['cookie_name'];
    
    PHP:
    Make sure to use setcookie() before echo. Also ALWAYS use hashed passwords only in both cookies and sessions.
     
    Cozmic, Jun 17, 2010 IP