php stay logged in?

Discussion in 'PHP' started by liam_d, Jan 3, 2006.

  1. #1
    Are cookies the only way to do a stay logged in function in php?
     
    liam_d, Jan 3, 2006 IP
  2. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    php has a special feature where if cookies are disabled, then they still stay logged in, the cookie code would be auto written in the browser url
     
    onlyican.com, Jan 3, 2006 IP
  3. TMan

    TMan Peon

    Messages:
    126
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This is called session id's, I suggest you search php.net for this.
     
    TMan, Jan 3, 2006 IP
  4. Juls

    Juls Well-Known Member

    Messages:
    1,867
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    170
    #4
    ya your options are sessions or cookies.

    php.net is a good place to check it out or just search google for php sessions.

    I personally hate using sids.
     
    Juls, Jan 3, 2006 IP
  5. MaxPowers

    MaxPowers Well-Known Member

    Messages:
    264
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #5
    SIDs in the URL basically stop search spiders in their tracks. The reason is that different query strings still repeat the same page and it is possiblt to have thousands of the same exact page... "not" spidering pages using a session ID in the URL is their answer.
     
    MaxPowers, Jan 4, 2006 IP
  6. TMan

    TMan Peon

    Messages:
    126
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You could easily track the user agent of the big 3, and than not include the sid's...
     
    TMan, Jan 5, 2006 IP
  7. liam_d

    liam_d Active Member

    Messages:
    306
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    80
    #7
    How do you stop session id's from appearing in the url?

    Thanks
     
    liam_d, Jan 5, 2006 IP
  8. n0other

    n0other Peon

    Messages:
    146
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Storing it in the cookie of course. That's a common practice :)
     
    n0other, Jan 5, 2006 IP
  9. dotboost

    dotboost Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    change in php.ini the value for session.use_cookies to 1, ON.
     
    dotboost, Jan 5, 2006 IP
  10. legend2

    legend2 Well-Known Member

    Messages:
    1,537
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    115
    #10
    Indeed, you can use sessions.
    at the top of every page you would nbeed to start a session using session_start(). note though that sessions expire and are killed when the browser is closed. so you better go for cookies.
     
    legend2, Jan 6, 2006 IP