From db3c0d658f8ad6467394255125d3fd3d139870b7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 18 Jul 2003 21:37:34 +0000 Subject: [PATCH] Forums. svn path=/trunk/boinc/; revision=1732 --- html/class/user.inc | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 html/class/user.inc diff --git a/html/class/user.inc b/html/class/user.inc new file mode 100644 index 0000000000..ebbc2c2111 --- /dev/null +++ b/html/class/user.inc @@ -0,0 +1,45 @@ + $value) + $this->$var = $$var; + } +} + +function getUser($userID) { + $sql = "SELECT * FROM user WHERE id = ".$userID; + return getNextUser(sql_query($sql)); +} + +function getUserByAuth($auth) { + $sql = "SELECT * FROM user WHERE authenticator = '$auth'"; + return getNextUser(sql_query($sql)); +} + +function getNextUser($result) { + $user = sql_fetch_array($result); + if (!$user) + return false; + foreach ($user as $var => $value) + $user[$var] = stripslashes($value); + + // Check whether or not this user has a profile. + $sql = "SELECT * FROM profile WHERE userid = " . $user['id']; + $result2 = sql_query($sql); + + if (sql_num_rows($result2) > 0) + $user['has_profile'] = 1; + + return new User($user['id'], $user['create_time'], $user['name'], $user['posts'], $user['has_profile']); +} + + +?> \ No newline at end of file