summaryrefslogtreecommitdiffstats
path: root/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'db.php')
-rw-r--r--db.php26
1 files changed, 26 insertions, 0 deletions
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));