Logout after time

Thread Solved

Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Re: Logout after time

 
0
  #11
Jul 19th, 2009
I am using a free webhost and don't know if they have cron on it, is there a code to check it or should I just go to help and support?
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Logout after time

 
0
  #12
Jul 19th, 2009
Its best to check with help and support.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Re: Logout after time

 
0
  #13
Jul 20th, 2009
Yes! It is available. I never noticed it before -_-

I don't know how to use it, is it possible for you to help me out a bit? Please and thank you.

EDIT:
Do I just run the code that was previously posted? I am guessing so...right?

-Toxikr3
Last edited by Toxikr3; Jul 20th, 2009 at 6:52 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Logout after time

 
0
  #14
Jul 20th, 2009
If your host has cpanel, you can do it from there easily.

Otherwise, check out some of the sites listed in the search.

http://www.google.com/#hl=en&q=cront...fp=Xmf0jJ9P_V0
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Re: Logout after time

 
0
  #15
Jul 20th, 2009
Yes, it has a cpanel, it only asks me to put the file name to run, and when to run it. Its quite simple, but I don't know if I need to run the code posted or a new code. Will the code know which user to put in the variable $userfinal? I don't know if it will work...

-Toxikr3
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Logout after time

 
1
  #16
Jul 20th, 2009
You will have to modify the code and maybe your database.

Pretty much you will need to use humbugs' solution.

In the cron file you will need to select all users that have not been active for lets say 10 minutes. Then run an update query for each user returned to set their status to 'offline'.
Last edited by kkeith29; Jul 20th, 2009 at 7:26 pm.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Re: Logout after time

 
0
  #17
Jul 20th, 2009
Alright, I will try that, thank you.
-Toxikr3
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: Logout after time

 
1
  #18
Jul 21st, 2009
Sorry for not getting back to you about my idea. What I meant was, you store the timestamp for each user's last activity in the database. Then any time you want to check if someone is "active" you grab the timestamp and make the comparison.

You can also get a list of "active" user by doing (psuedocode) "SELECT * FROM user_activity WHERE timestamp>TIME()-60*5"

All you need to do for this is update the user's "last activity" timestamp every time they request a page, and you'll be laughing.

If you want it to be more accurate you can use AJAX to send a request to the server every 4 mins to tell the server that the user still has the webpage open in his/her browser.

Hope that helped. (I'm not saying the other way won't work either..)
"If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 27
Reputation: Toxikr3 is an unknown quantity at this point 
Solved Threads: 0
Toxikr3 Toxikr3 is offline Offline
Light Poster

Re: Logout after time

 
0
  #19
Jul 21st, 2009
Thanks! I was wondering about the comparison code
-Toxikr3
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: Logout after time

 
0
  #20
Jul 22nd, 2009
For each user you want to check, you would do something like this:
1. Get the timestamp for this user from the database
SELECT last_activity FROM user_activity WHERE id=$id 2. Compare this value with the timestamp for 5 mins ago within PHP
if ($last_activity > $now-60*5) { echo "online" }
I couldn't be bothered looking up the PHP code for getting timestamps, or translating to and from MySQL timestamps, but you can do that
"If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC