X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=cbcc2f2f0d699a5c460ea41650065e0b7db621c3;hp=8b567fd90efd5a5f2395a769740d2509aad5ca7c;hb=0ef11ea847d9891e19605e6c93cb4c7296df0a57;hpb=d57105094a2e224bd7f4f03b11ab96a45383fea2 diff --git a/index.php b/index.php index 8b567fd..cbcc2f2 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,18 @@ \n"; + echo "perhaps the game has been cancled, check by login in here."; + 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); + $mystatus = DB_get_status_by_hash($me); + $mypos = DB_get_pos_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) + { + $message = "Hello, \n\n". + "Game $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 cancled (timed out)",$message); + } + + /* delete everything from the dB */ + DB_cancel_game($me); + + echo "
Game $gameid has been cancled.
You need to wait longer before you can cancle a game...
\n"; +} else if(myisset("me")) - { - /* handle request from one specific player, - * the hash is set on a per game base - */ - - $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.