X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=216a431b50ecc11e556fedc7138c055b431c88db;hp=5bc9e4526803a8828d3b02f3f238e72ac063014b;hb=14e087ec31455a9d1780ffbf6a2cf883d9b6bfc5;hpb=1609d836dc4157e318707b6a5a859f42b527b0cf diff --git a/index.php b/index.php index 5bc9e45..216a431 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.

"; + } + else + echo "

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.
\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); - +{ + /* 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.
\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); + + echo "

Game $gameid

\n"; + switch($mystatus) { case 'start': @@ -159,7 +223,7 @@ else if(myisset("me")) foreach($userids as $user) { $To = DB_get_email_by_userid($user); - mymail($To,"[DoKo] game cancled",$message); + mymail($To,$EmailName."game cancled",$message); } /* delete everything from the dB */ @@ -189,7 +253,7 @@ else if(myisset("me")) echo "checking if you selected solo or nines...
". " if you have a wedding, please send an email to the other players.
". " if you have poverty you need to play a normal game,sorry...
". - " At the moment you need to reload this page to finish the setup.
"; + " Please click here to finish the setup.
"; if(!myisset("solo","wedding","poverty","nines") ) { /* all these variables have a pre-selected default, @@ -249,7 +313,7 @@ else if(myisset("me")) * tell people about it. */ echo "
checking if someone else selected solo or nines... wedding and poverty not handled at the moment
". - "reload this page to finish the setup
"; + " Please click here to finish the setup.
"; /* only set this after all poverty, etc. are handeled*/ DB_set_hand_status_by_hash($me,'play'); @@ -290,7 +354,7 @@ else if(myisset("me")) foreach($userids as $user) { $To = DB_get_email_by_userid($user); - mymail($To,"[DoKo] game cancled",$message); + mymail($To,$EmailName."game cancled",$message); } /* delete everything from the dB */ @@ -432,7 +496,7 @@ else if(myisset("me")) $play = array(); /* needed to calculate winner later */ $seq = 1; - $pos = 0; + $pos = DB_get_startplayer_by_gameid($gameid)-1; $firstcard = ""; /* first card in a trick */ echo "\n