Since the game is 1. Text based, and 2. Small population, and since I could not get the cookie to no longer work, I took this route (somewhat redundant - but good alternative)
[size=12pt]keep in mind this is a kludge:[/size]
[php]function KillDeadBeats() // may use KillDeadBeats($id) on busy servers
{
$sql = "SELECT * FROM player
";
$query = mysql_query($sql);
$limit = time() + 900;
while($slacker = mysql_fetch_assoc($query))
{
if ( ($slacker['last_on'] + 900) > $limit ) // fell asleep
{
update_record('player','on_now',0,'id',$slacker['id']);
}
}
}[/php]
Once it has checked for everyone that has exceeded 15 min, check to see if the current player got bumped
[php]
if(isset($_SESSION[‘userid’]))
{
$u = GetUser($_SESSION[‘userid’]);
if ($u[‘on_now’] == 0)
{
$_REQUEST[‘q’] = ‘afk’;
}
/** stupid cookie fail
if(!isset($_COOKIE['lotrd']))
{
header('index.php?q=afk');
}else{
setcookie('lotrd','afk',time()+900);
}
*/
}
[/php]
and it finally sends them to afk - JUST LIKE the simple cookie method did. As you can see, cookie might have been a better option, but the more I look at this, the more I like this one better. preference I guess
*Note: elsewhere in the program, player is allotted more time, if they are not afk.
anyways. would really like to know why the cookie wont set (did on many of my drafts, but not this draft)