From 6d65997f0c6b4974902e5c503696963443d8ccff Mon Sep 17 00:00:00 2001 From: Evangelos Foutras Date: Thu, 12 Nov 2009 17:20:07 +0200 Subject: Add uid_from_email(), similar to uid_from_username Signed-off-by: Loui Chang --- web/lib/aur.inc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/web/lib/aur.inc b/web/lib/aur.inc index 517abe3..f940192 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -400,7 +400,26 @@ function uid_from_username($username="") return "None"; } $row = mysql_fetch_row($result); - + + return $row[0]; +} + +# obtain the uid given a Users.Email +# +function uid_from_email($email="") +{ + if (!$email) { + return ""; + } + $dbh = db_connect(); + $q = "SELECT ID FROM Users WHERE Email = '".mysql_real_escape_string($email) + ."'"; + $result = db_query($q, $dbh); + if (!$result) { + return "None"; + } + $row = mysql_fetch_row($result); + return $row[0]; } -- cgit v1.2.3-70-g09d2