SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot wh33t's Avatar
    Join Date
    Aug 2011
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I make a Session persist through a browser exit?

    Hey SP,

    The website I work on is having some issues with (L)users adding items into their shopping carts, disappearing from their computers for up to a few days and then sending in support emails when they discover that their shopping cart is now empty without them placing their orders.

    So first question, is the web server that is destroying the session cookie due to idle? If so, how can I extend this to last say... 1 week?

    If it's not the web server then it must be the clients browser, is there some coding technique I have to utilize to encourage their browser to leave the session cookie open?

    Currently I'm just doing a simple session_start(); in the global header include and then using the session_id() to identify the users shopping cart items, which are stored in the mysql Database.

    Any tips in the right direction would be appreciated, thank you.

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Location
    United Kingdom
    Posts
    78
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can over-ride PHP's default session handling mechanism by using the session_set_save_handler() function. This enables you to achieve session persistence by storing the session data inside a database.

  3. #3
    SitePoint Zealot wh33t's Avatar
    Join Date
    Aug 2011
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by modernW View Post
    You can over-ride PHP's default session handling mechanism by using the session_set_save_handler() function. This enables you to achieve session persistence by storing the session data inside a database.
    Thank you. I'll look into that.


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
  •