X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fcancelgame.php;h=b0b4db9ba392bd1babc919d86deccf048f2b9056;hp=5b855347bab0794f65e220de04579e9e214fef58;hb=268859f56cb8f19b65eca8550dd6a71b6d475971;hpb=086ed1db2ec28817b3370481455c84ceaf6448c2 diff --git a/include/cancelgame.php b/include/cancelgame.php index 5b85534..b0b4db9 100644 --- a/include/cancelgame.php +++ b/include/cancelgame.php @@ -1,18 +1,18 @@ \n"; - output_footer(); - DB_close(); - exit(); + return; } $me = $_REQUEST["me"]; @@ -23,9 +23,7 @@ if(!$myid) { echo "Can't find you in the database, please check the url.
\n"; echo "perhaps the game has been canceled, check by login in here."; - output_footer(); - DB_close(); - exit(); + return; } DB_update_user_timestamp($myid); @@ -40,21 +38,22 @@ if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */ { $message = "Hello, \n\n". "Game ".DB_format_gameid($gameid). - " has been canceled since nothing happend for a while and $myname requested it.\n"; + " has been canceled since nothing happend for a while and $myname requested it.\n\n"; + /* email to all players */ $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) { - $To = DB_get_email('userid',$user); - mymail($To,$EmailName."game ".DB_format_gameid($gameid)." canceled (timed out)",$message); + $subject = "Game ".DB_format_gameid($gameid)." canceled (timed out)"; + mymail($user,$subject,$message); } - /* delete everything from the dB */ - DB_cancel_game($me); + /* set gamestatus to canceled */ + cancel_game('timedout',$gameid); echo "

Game ".DB_format_gameid($gameid). " has been canceled.

"; } - else + else /* game can't be canceled yet */ echo "

You need to wait longer before you can cancel a game...

\n"; ?> \ No newline at end of file