X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=980db24fcdd2f7909acd2ab148fa2316cb051f0b;hp=83ada9ad8080b2482582b2cd135c8829bc0033d4;hb=9bceb4f3447a82affb63b4994bf3509f2e6758d4;hpb=b6d9a4aa79763981c524b3915ab11e449cad4c42 diff --git a/index.php b/index.php index 83ada9a..980db24 100644 --- a/index.php +++ b/index.php @@ -94,7 +94,7 @@ if(myisset("new")) $ruleset = DB_get_ruleset_by_gameid($followup); /* just copy ruleset from old game, this way no manipulation is possible */ if($session) - mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1','1','pre',". + mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1',NULL,'pre',". "'$ruleset','$session' ,NULL)"); else { @@ -102,12 +102,12 @@ if(myisset("new")) $max = DB_get_max_session(); $max++; mysql_query("UPDATE Game SET session='".$max."' WHERE id=".DB_quote_smart($followup)); - mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1','1','pre',". + mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1',NULL,'pre',". "'$ruleset','$max' ,NULL)"); } } else - mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1','1','pre', ". + mysql_query("INSERT INTO Game VALUES (NULL, NULL, '$randomNRstring', 'normal', NULL,NULL,'1',NULL,'pre', ". "'$ruleset',NULL ,NULL)"); $game_id = mysql_insert_id(); @@ -439,21 +439,29 @@ else if(myisset("me")) { $userstat = DB_get_hand_status_by_userid_and_gameid($user,$gameid); if($userstat!='poverty' && $userstat!='play') - $ok = 0; + { + $ok = 0; + DB_set_player_by_gameid($gameid,$user); + } }; if($ok) - foreach($userids as $user) - { - $To = DB_get_email_by_userid($user); - $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - if($userhash != $me) - { - $message = "Everyone finish the questionary in game $gameid, ". - "please visit this link now to continue: \n". - " ".$host."?me=".$userhash."\n\n" ; - mymail($To,$EmailName." finished setup in game $gameid",$message); - } - }; + { + /* reset player = everyone has to do something now */ + DB_set_player_by_gameid($gameid,NULL); + + foreach($userids as $user) + { + $To = DB_get_email_by_userid($user); + $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); + if($userhash != $me) + { + $message = "Everyone finish the questionary in game $gameid, ". + "please visit this link now to continue: \n". + " ".$host."?me=".$userhash."\n\n" ; + mymail($To,$EmailName." finished setup in game $gameid",$message); + } + }; + }; }; break; @@ -803,7 +811,6 @@ else if(myisset("me")) " ".$host."?me=".$userhash."\n\n" ; mymail($To,$EmailName." poverty (game $gameid)",$message); } - } /* this user is done */ @@ -896,63 +903,64 @@ else if(myisset("me")) else echo "it's not your turn yet to decide if you want to take the trump or not."; } - }; - } - /* check if no one wanted to take trump, in that case the gamesickness would be set to 5 or 50 */ - $who = DB_get_sickness_by_gameid($gameid); - if($who==5 || $who==50) - { - $message = "Hello, \n\n". - "Game $gameid has been cancled since nobody wanted to take the trump.\n"; - - $userids = DB_get_all_userid_by_gameid($gameid); - foreach($userids as $user) + /* check if no one wanted to take trump, in that case the gamesickness would be set to 5 or 50 */ + $who = DB_get_sickness_by_gameid($gameid); + if($who==5 || $who==50) { - $To = DB_get_email_by_userid($user); - mymail($To,$EmailName."game $gameid cancled (poverty not resolved)",$message); + $message = "Hello, \n\n". + "Game $gameid has been cancled since nobody wanted to take the trump.\n"; + + $userids = DB_get_all_userid_by_gameid($gameid); + foreach($userids as $user) + { + $To = DB_get_email_by_userid($user); + mymail($To,$EmailName."game $gameid cancled (poverty not resolved)",$message); + } + + /* delete everything from the dB */ + DB_cancel_game($me); + + echo "
Game $gameid has been cancled.
Game $gameid has been cancled.