added email to all players, in case someone cancled the game at the beginning
authorarun <arun@nubati.net>
Fri, 12 Jan 2007 14:49:15 +0000 (14:49 +0000)
committerarun <arun>
Fri, 12 Jan 2007 14:49:15 +0000 (14:49 +0000)
functions.php
index.php

index e4f7c60a141bb49f0d79f5ce6b4d0f5d22c5f3aa..ec7dfacbf67d247a8ada7f713732d468bdd9f2fe 100644 (file)
@@ -156,7 +156,6 @@ function get_winner($p,$mode)
   $c3 = $p[3];
   $c4 = $p[4];
 
-
   /* first card is better than all the rest */
   if( compare_cards($c1,$c2,$mode) && compare_cards($c1,$c3,$mode) && compare_cards($c1,$c4,$mode) )
     return 1; 
index 605a94b42963030fbf6dfc1932e05b51c938aaff..36b59efbd19e6d8ff2be26003cf2c762beaca169 100644 (file)
--- a/index.php
+++ b/index.php
@@ -152,15 +152,16 @@ else if(myisset("me"))
          {
            if($_REQUEST["in"] == "no")
              {
-               echo "TODO: email everyone that the game has been canceled.<br />";
-                /*something like need to modify for DB backend
-                for($i=0;$i<4;$i++)
-                  {
-                    $message = "Hello ".$player[$hash[$i]]["name"].",\n\n".
-                      "the game has been canceled due to the request of one of the players.\n";
-                    mymail($player[$hash[$i]]["email"],"[DoKo-Debug] the game has been canceled",$message); 
-                  }
-                */
+               $message = "Hello, \n\n".
+                 "the game has been canceled due to the request of one of the players.\n";
+               
+               $userids = DB_get_all_userid_by_gameid($gameid);
+               foreach($userids as $user)
+                 {
+                   $To = DB_get_email_by_userid($user);
+                   mymail($To,"[DoKo] game over",$message);
+                 }
+               
                /* delete everything from the dB */
                DB_cancel_game($me);
              }