SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ending a session

    i used session_start() to start someone's, so that variables could be carried from page to page.

    How do I end the session that session_start() started for a specific computer?

    Thanks
    Jim
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  2. #2
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    got it covered

    i was using session_destroy() incorrectly before it works now with about a 5 line logout script.....wow, i love PHP, and i've only known it for about 3 days. its a beautiful thing
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  3. #3
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Really? I thought the only way to end a session is to close your browser!

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your kidding, right?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i was tempted to post something like that... you ARE kidding aren't you... i may be new to PHP but from what i've read so far that pretty much allows you to end a session without closing your browser

  6. #6
    SitePoint Evangelist
    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, session_destroy unsets the current session, but it doesn't unset any variables. So, if you call session_destroy, it will not affect the immediate page. You need to wait for the next page, before you can see the effect of session_destroy()

  7. #7
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't know the extent of which it "kills" the session, but I was having this problem before that I would log in as one user correctly, but then If I tried to log in as another right off the bat, it would take me to the edit page under the old username.

    But using session_destroy() it lets me change usernames.....serves my purposes

    does anyone know how I can set the life of a cookie in .htaccess!?

    Thanks
    Jim
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  8. #8
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you don't set a cookie's life in .htaccess, you set it when you make a cookie.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  9. #9
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not kidding. I posted the problem in this thread (the one next to the last post)

    http://www.sitepointforums.com/showt...threadid=34674

    and no one correct me.

  10. #10
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but session_start() automatically creates my cookie, correct?

    How do I use session start and still be able to set the cookie time?

    Thanks
    Jim
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  11. #11
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    session_start() does create a cookie, but only if cookies are set to on in php.ini, but it only stores the session id in the cookie.
    You can also use the SID in the url to keep the session.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •