summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorEvangelos Foutras <foutrelis@gmail.com>2009-11-12 17:20:07 +0200
committerLoui Chang <louipc.ist@gmail.com>2009-11-13 16:49:55 -0500
commit6d65997f0c6b4974902e5c503696963443d8ccff (patch)
tree8819224960f99424ceb2b0798b804858b8248481 /web/lib
parent6ee8b88c58c984489e13eb26f8509fe1ddb1510a (diff)
downloadaurweb-6d65997f0c6b4974902e5c503696963443d8ccff.tar.xz
Add uid_from_email(), similar to uid_from_username
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/aur.inc21
1 files changed, 20 insertions, 1 deletions
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];
}