From 97dc3b828845ca92c4eab2b0df38afdbc167b423 Mon Sep 17 00:00:00 2001 From: arun Date: Tue, 10 Apr 2007 15:26:58 +0000 Subject: added email to first player at the beginning of the game; fixed small layout issue --- db.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'db.php') diff --git a/db.php b/db.php index b3651bd..7b6ba17 100644 --- a/db.php +++ b/db.php @@ -70,6 +70,21 @@ function DB_get_email_by_userid($id) return ""; } +function DB_get_email_by_pos_and_gameid($pos,$gameid) +{ + $result = mysql_query("SELECT email FROM User ". + "LEFT JOIN Hand ON User.id=Hand.user_id ". + "LEFT JOIN Game ON Game.id=Hand.game_id ". + "WHERE Game.id=".DB_quote_smart($gameid)." ". + "AND Hand.position=".DB_quote_smart($pos).""); + $r = mysql_fetch_array($result,MYSQL_NUM); + + if($r) + return $r[0]; + else + 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).""); @@ -179,6 +194,17 @@ function DB_get_name_by_hash($hash) return ""; } +function DB_get_name_by_email($email) +{ + $result = mysql_query("SELECT fullname FROM User WHERE email=".DB_quote_smart($email)); + $r = mysql_fetch_array($result,MYSQL_NUM); + + if($r) + return $r[0]; + else + return ""; +} + function DB_get_name_by_userid($id) { $result = mysql_query("SELECT fullname FROM User WHERE id=".DB_quote_smart($id)); -- cgit v1.2.3-18-g5258