From dc3b13064cdb59dd12b200e7f8c73fd63126dea6 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 26 Jun 2004 13:21:04 +0000 Subject: mypkgs works, but need an 'action' table --- web/lib/aur.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'web/lib/aur.inc') 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() { -- cgit v1.2.3-24-g4f1b