\n"; echo "perhaps the game has been cancled, check by login in here."; output_footer(); DB_close(); exit(); } DB_update_user_timestamp($myid); /* get some information from the DB */ $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name_by_hash($me); /* check if game really is old enough */ $result = mysql_query("SELECT mod_date from Game WHERE id='$gameid' " ); $r = mysql_fetch_array($result,MYSQL_NUM); if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */ { $message = "Hello, \n\n". "Game ".DB_format_gameid($gameid)." has been cancled since nothing happend for a while and $myname requested it.\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) { $To = DB_get_email_by_userid($user); mymail($To,$EmailName."game ".DB_format_gameid($gameid)." cancled (timed out)",$message); } /* delete everything from the dB */ DB_cancel_game($me); echo "
Game ".DB_format_gameid($gameid)." has been cancled.
You need to wait longer before you can cancle a game...
\n"; } /* send out a reminder */ else if(myisset("remind","me")) { $me = $_REQUEST["me"]; /* test for valid ID */ $myid = DB_get_userid_by_hash($me); if(!$myid) { echo "Can't find you in the database, please check the url.An email has already been sent out.
\n"; } else { DB_set_reminder($r[1],$gameid); mymail($To,$EmailName."Reminder: game ".DB_format_gameid($gameid)." it's your turn",$message); echo "Game ".DB_format_gameid($gameid).": an email has been sent out.
You need to wait longer before you can send out a reminder...
\n"; } /* handle request from one specific player for one game, * (the hash is set on a per game base) */ else if(myisset("me")) { $me = $_REQUEST["me"]; /* test for valid ID */ $myid = DB_get_userid_by_hash($me); if(!$myid) { echo "Can't find you in the database, please check the url.Session:
\n";
echo " p = pre-game phase ";
echo "P = game in progess ";
echo "F = game finished
";
echo "
\n"; while( $r = mysql_fetch_array($result,MYSQL_NUM)) { $game = DB_format_gameid($r[1]); $gamenr = (int) $game; if($gamenrold < $gamenr) { if($gamenrold!=-1) echo " | |||
$gamenr: | "; else echo "$gamenr: | "; $gamenrold = $gamenr; } if($r[4]=='pre') { echo "\n p "; } else if ($r[4]=='gameover') echo "\n F "; else { echo "\n P "; } if($r[4] != 'gameover') { echo " | \n "; if($r[3]) { if($r[3]==$myid) echo "(it's your turn)\n"; else { $name = DB_get_name_by_userid($r[3]); $gameid = $r[1]; if(DB_get_reminder($r[3],$gameid)==0) if(time()-strtotime($r[2]) > 60*60*24*7) echo "". "Send a reminder."; echo "(it's $name's turn)\n"; }; } if(time()-strtotime($r[2]) > 60*60*24*30) echo "". "Cancel?". " (clicking here is final and can't be restored)"; } } echo " |
\n"; echo implode(", ",$names)."\n"; echo "
\n