#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    1
    Rep Power
    0
    I'm making an e-commerce shop and I'm using sessions.
    I want a session to stop after a certain time. This is saver for the customers, because if the customer didn't log off and close the browser another person could do stuff with the customers personal things.

    session.cookie_lifetime in the php.ini file can't be changed by me (I'm not the only one working on the machine).

    I found the function session_set_cookie_lifetime(int lifetime, but I don't really understand how to use it.

    I have application.php, in this script all the configuration is done, and also the session is set.
    This script is included in all the other scipts I use.
    If I put session_set_cookie_lifetime in this file it will be called each time you use it.

    I thought of another way.
    Making a session variable called "time". I put the current time in seconds + the time the person has in the shop in this variable.
    I compare it to the current time, if the time is the same or higher the session variables will be reset.
    The only problem I have with this is that it doesn't work if the logintim is 23.22 (or something like that) and the current time is 01:01 (or something like that), because 01:00 is smaller than 23:22 and it will continu until it's later than 23:22.

    Well, I hope someone has a good Idea that works better than all this crap.

    I'm waiting,

    Anita

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    35
    Rep Power
    14
    why not use Unix timestamp, it increase every second.

    ------------------
    Good Good Study
    Day Day Up
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    1
    Rep Power
    0


    Well, I just found that sollution too (after 1 1/2 day), thanks anyway!!

    I have a session variable 'time' where I store time() + time to spend in the shop.
    I compare this with the current time ( time() ) when the customer loads a page.
    If the time is up all the session variables are reset.

Similar Threads

  1. URL session handling problem
    By rec3000 in forum PHP Development
    Replies: 6
    Last Post: February 24th, 2009, 08:33 AM
  2. start session with existing session id?
    By marco-marco in forum PHP Development
    Replies: 1
    Last Post: February 16th, 2004, 06:05 AM
  3. Problems with session
    By Petras in forum Java Help
    Replies: 2
    Last Post: February 12th, 2004, 01:37 AM
  4. Undefined variable and session problems (Was: need help! badly!)
    By pinkipodmini in forum PHP Development
    Replies: 13
    Last Post: January 18th, 2004, 03:21 PM
  5. session problems
    By iso in forum PHP Development
    Replies: 6
    Last Post: October 30th, 2003, 07:04 PM

IMN logo majestic logo threadwatch logo seochat tools logo