Jump to content
MakeWebGames

(v2) session limits


Godhand

Recommended Posts

I was thinking for a while to limit how long a player can stay on. I was trying to do something like

if($ir['lifespan'])=0
$db->query("UPDATE users SET force_logout=force_logout+1 WHERE userid=$userid");

I kept getting unexpected = error. I'd also like to know how I should set the crons up. I have another stat for this also besides lifespan (cooldown) I mean more of the formula I should use to approach this to start with to avoid glitches.Thanks for your help

Link to comment
Share on other sites

Re: (v2) session limits

Yes I know this is a double post. So I started to code though a little while. I'm using stats to get a session limit to prevent people from playing constantly.I know that I don't have this set up in my crons yet because of a problem.

<?php
if(!$ir['cooldown'])
{
$db->query("UPDATE users SET force_logout=force_logout+1 WHERE userid=$userid");
}





$query="UPDATE users SET lifespan=lifespan-5 WHERE $r['laston'] >=time()-5*60 AND lifespan>0 AND cooldown=0"; 
$query="UPDATE users SET cooldown=cooldown-5 WHERE lifespan=0 AND cooldown>0"; 
$query="UPDATE users SET cooldown=cooldown+15 WHERE lifespan=0 AND cooldown=0"; 
$query="UPDATE users SET lifespan=36 WHERE lifespan=0 AND cooldown=0 AND $r['laston'] >=time()-5*60"; 

$db->query($query);
$db->query($query2);
$db->query($query3);
$db->query($query4);

?>

the problem is

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/myinfo/whateverhere/botprotection.php on line 11

which if we go there it will show

 
$query="UPDATE users SET lifespan=lifespan-5 WHERE $r['laston'] >=time()-5*60 AND lifespan>0 AND cooldown=0"; 

And I *know* that if the problem is the $r['laston'] >=time()-5*60 then there will be the same problem in another line of the code. Any thoughts that would constructively help?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...