summaryrefslogtreecommitdiffstats
path: root/web/lib/aur.inc
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib/aur.inc')
-rw-r--r--web/lib/aur.inc20
1 files changed, 20 insertions, 0 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index f59e63a6..9407a401 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -202,6 +202,26 @@ function account_from_sid($sid="") {
return $row[0];
}
+# obtain the Users.ID if given their current SID
+#
+function uid_from_sid($sid="") {
+ if (!$sid) {
+ return "";
+ }
+ $dbh = db_connect();
+ $q = "SELECT Users.ID ";
+ $q.= "FROM Users, Sessions ";
+ $q.= "WHERE Users.ID = Sessions.UsersID ";
+ $q.= "AND Sessions.SessionID = '" . mysql_escape_string($sid) . "'";
+ $result = db_query($q, $dbh);
+ if (!$result) {
+ return 0;
+ }
+ $row = mysql_fetch_row($result);
+
+ return $row[0];
+}
+
# connect to the database
#
function db_connect() {