summaryrefslogtreecommitdiffstats
path: root/web/lib/aur.inc
diff options
context:
space:
mode:
authorEvangelos Foutras <foutrelis@gmail.com>2009-11-12 16:20:07 +0100
committerLoui Chang <louipc.ist@gmail.com>2009-11-13 22:49:55 +0100
commit6d65997f0c6b4974902e5c503696963443d8ccff (patch)
tree8819224960f99424ceb2b0798b804858b8248481 /web/lib/aur.inc
parent6ee8b88c58c984489e13eb26f8509fe1ddb1510a (diff)
downloadaur-6d65997f0c6b4974902e5c503696963443d8ccff.tar.gz
aur-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/aur.inc')
-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 517abe31..f9401927 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];
}