Jump to content


Photo

inactive users


  • Please log in to reply
5 replies to this topic

#1 derek.sullivan

derek.sullivan

    Jedi In Training

  • Members
  • PipPip
  • 343 posts
  • Gender:Male
  • Location:Georgia
  • Interests:preaching, programming, music, friends, outdoors, moves, books

Posted 13 May 2011 - 09:03 PM

How would I create a script that automatically logs users out if they are inactive for lets say 5 minutes? Not quite sure how to accomplish this task on my own, need help!

#2 derek.sullivan

derek.sullivan

    Jedi In Training

  • Members
  • PipPip
  • 343 posts
  • Gender:Male
  • Location:Georgia
  • Interests:preaching, programming, music, friends, outdoors, moves, books

Posted 14 May 2011 - 09:00 AM

And if the user before 5 minutes becomes active again, it will refresh the timeout?

#3 derek.sullivan

derek.sullivan

    Jedi In Training

  • Members
  • PipPip
  • 343 posts
  • Gender:Male
  • Location:Georgia
  • Interests:preaching, programming, music, friends, outdoors, moves, books

Posted 14 May 2011 - 06:35 PM

any tutorial suggestions that you could link me to? I have no clue how to program in JS.

#4 Hayden

Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 717 posts
  • Gender:Male
  • Location:Texas

Posted 14 May 2011 - 09:42 PM

any tutorial suggestions that you could link me to? I have no clue how to program in JS.



An Ajax call to a PHP script that would check the session information and return a boolean if they should be kept logged in or not. Let the PHP script do all the work, the JS just queries the PHP script and redirects if necessary.

#5 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 15 May 2011 - 12:34 PM

The other issue you have to be concerned about is if they leave your site before the 5 minutes is up. Do you want to still log them out? If so, you will need to record their "last active" time in the database and check that every time your script runs. If you forcefully boot them from your site after 5 minutes of inactivity, then you can use the JS method.

#6 derek.sullivan

derek.sullivan

    Jedi In Training

  • Members
  • PipPip
  • 343 posts
  • Gender:Male
  • Location:Georgia
  • Interests:preaching, programming, music, friends, outdoors, moves, books

Posted 15 May 2011 - 08:51 PM

RC, the answer to your question is yes. so I will see what I can do with the suggestions that you two gave me :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users