Jump to content


Photo

Log off


  • Please log in to reply
4 replies to this topic

#1 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 14 June 2006 - 01:18 PM

I have a table for users that are currently online, how do I set them offline if they click the close browser button? Can I retrieve this action? Thanks for your help?

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 14 June 2006 - 01:32 PM

possibly with some javascript event checking like an onclose, doing some ajax to update it. but i'm not sure if it is possible for you to get onclose to execute a function if the user straight up clicks the close window X button. it is for sure not possible with only php.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 crouchjay

crouchjay
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 14 June 2006 - 01:49 PM

How do other sites take care of this problem? Do I need to create a deamon that checks connectivity of users every so often?

#4 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 14 June 2006 - 01:55 PM

it's simple, you have an expiry for the session which is set to about lets say 30 minutes after each action of that same user within the site, then in the session verification which each user has on every page load add an sql line which checks `expire` vs. the time() and those which are less than time() are deleted (logged off)
z..z..z..z..z..z..z..z..

#5 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 14 June 2006 - 04:53 PM

yes, you will have to do like a cron job to check the last activity of the person, if you want strictly php. with php you simply don't know if the user is taking a really long time reading a post or something, or if they closed their browser or what.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users