2 /* make sure that we are not called from outside the scripts,
3 * use a variable defined in config.php to check this
12 echo "Hmm, you really shouldn't mess with the urls.<br />\n";
16 $me = $_REQUEST["me"];
18 /* test for valid ID */
19 $myid = DB_get_userid('hash',$me);
22 echo "Can't find you in the database, please check the url.<br />\n";
23 echo "perhaps the game has been canceled, check by login in <a href=\"$INDEX\">here</a>.";
27 DB_update_user_timestamp($myid);
29 /* get some information from the DB */
30 $gameid = DB_get_gameid_by_hash($me);
31 $myname = DB_get_name('hash',$me);
33 /* check if game really is old enough to be canceled */
34 $r = DB_query_array("SELECT mod_date from Game WHERE id='$gameid' " );
35 if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */
37 $message = "Hello, \n\n".
38 "Game ".DB_format_gameid($gameid).
39 " has been canceled since nothing happend for a while and $myname requested it.\n";
41 $userids = DB_get_all_userid_by_gameid($gameid);
42 foreach($userids as $user)
44 $To = DB_get_email('userid',$user);
45 mymail($To,$EmailName."game ".DB_format_gameid($gameid)." canceled (timed out)",$message);
48 /* delete everything from the dB */
51 echo "<p style=\"background-color:red\";>Game ".DB_format_gameid($gameid).
52 " has been canceled.<br /><br /></p>";
55 echo "<p>You need to wait longer before you can cancel a game...</p>\n";