SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: PHP Timer?

  1. #1
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm programming a members area, and have a problem

    when the user logs in, it changes the value in column 'online' to yes, and when they logout, it changes to no

    what i need is a timer, so that if they dont logout, it automatically logs them out after xx minutes

  2. #2
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a cookie

  3. #3
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How?

    thanx for quick response

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know much but you could use Javascript or PHP.

    Ask in the Client Side Scriptin Forum, there you could find out how to do it using Javascript.

  5. #5
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx

    is there any way i could do it in PHP?

    its a cool script (or will be )

  6. #6
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do it in PHP, but again, i have no idea how. Try the php manual:

    http://www.php.net/manual/


  7. #7
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why all the trouble when you can just use sessions and their builtin time out setting?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you just need to respond to the fact that they have been at your page for a certain amount of time, set a cookie with a timer.

    setCookie('user','valid', time()+600);

    This will set a cookie with the variable $user = "valid" and will expire in 10 minutes (600 seconds). then you can just test whether that user is still valid when a page loads.

    if($user == "valid"){
    //they are a valid user here LT 10 mins
    } else{ echo("get out"); }

  10. #10
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I Know this porbably seems stupid, but how do i use the PHP Sessions timout feature?

    Alex


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
  •