session time from log in

Hello,

I am trying to find the correct code (I have searched awhile and either i’m not typing it correctly or i just can’t find it) I have a few web based games that i program and I have users that have set up macros to login and play the game for them while they are afk…essentially giving them an unfair advantage. I have already install my version of a Capticha for log ins, but I want to set sessions to exactly 60 minutes. Not 60 minutes from the last time they loaded a page. That way forcing them to re log in every hour and have to really be there. I know there is no way to eliminate botting and macroing 100%, but this will cut it down tremendously. With this they would only be able to run a bot for 1 hour before having to log in again.

Thanks,
Keck

log the time of login in the database as a timestamp.

periodically check for idle by checking the timestamp in the database (+3600 (1 hour)) against the current timestamp.

IE:
[php]$dbtimestamp = 1000000 + 3600
= 1003600
$newtimestamp = 1004000

if($newtimestamp > $dbtimestamp) {
// user is idle
}
else {
// user is active
}[/php]

Hope that helps,
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service