From be3e7ed509f7fd3f2009b1ad06554a0c07e1a781 Mon Sep 17 00:00:00 2001 From: arun Date: Tue, 12 Dec 2006 11:55:39 +0000 Subject: [PATCH] players should get emails again, if it is there turn --- db.php | 11 +++++++++++ functions.php | 15 +++++++++++++++ index.php | 49 ++++++++++++++++++++++--------------------------- 3 files changed, 48 insertions(+), 27 deletions(-) diff --git a/db.php b/db.php index 7f44350..fde7ab6 100644 --- a/db.php +++ b/db.php @@ -59,6 +59,17 @@ function DB_get_email_by_name($name) return ""; } +function DB_get_email_by_hash($hash) +{ + $result = mysql_query("SELECT User.email FROM User LEFT JOIN Hand ON Hand.user_id=User.id WHERE Hand.hash=".DB_quote_smart($hash).""); + $r = mysql_fetch_array($result,MYSQL_NUM); + + if($r) + return $r[0]; + else + return ""; +} + function DB_get_userid_by_name($name) { $result = mysql_query("SELECT id FROM User WHERE fullname=".DB_quote_smart($name)); diff --git a/functions.php b/functions.php index abf2b82..390f6c9 100644 --- a/functions.php +++ b/functions.php @@ -435,4 +435,19 @@ function return_timezone($offset) return $zone; } +function output_form_for_new_game() +{ +?> +

Please add 4 names, please make sure that the names are correct!

+
+ Name: + Name: + Name: + Name: + + +
+ \ No newline at end of file diff --git a/index.php b/index.php index 6208038..ea5724a 100644 --- a/index.php +++ b/index.php @@ -52,17 +52,7 @@ DB_open(); /* check if we want to start a new game */ if(isset($_REQUEST["new"])) { -?> -

Please add 4 names, please make sure that the names are correct!

-
- Name: - Name: - Name: - Name: - - -
-\n"; echo "perhaps the game has been cancled."; - exit(); + 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); - - /* get game id */ - $gameid = DB_get_gameid_by_hash($me); switch($mystatus) { @@ -190,7 +179,6 @@ else if(isset($_REQUEST["me"])) check_want_to_play($me); DB_set_hand_status_by_hash($me,'init'); break; - case 'init': if( !isset($_REQUEST["in"]) || !isset($_REQUEST["update"])) { @@ -201,7 +189,7 @@ else if(isset($_REQUEST["me"])) { if($_REQUEST["in"] == "no") { - echo "TODO: email everyone that the game has been canceld
"; + echo "TODO: email everyone that the game has been canceled.
"; /*something like for($i=0;$i<4;$i++) { @@ -296,7 +284,7 @@ else if(isset($_REQUEST["me"])) display_news(); display_status(); - $gamestatus =DB_get_game_status_by_gameid($gameid); + $gamestatus = DB_get_game_status_by_gameid($gameid); if($gamestatus == 'pre') { echo "you need to wait for the others...
"; @@ -325,17 +313,17 @@ else if(isset($_REQUEST["me"])) $lasttrick = DB_get_max_trickid($gameid); $play = array(); /* needed to calculate winner later */ - $seq=1; - $pos=0; + $seq = 1; + $pos = 0; echo "\n