db_connect_id) { echo "


Error:


Connection to database failed









"; exit(); } function get_sid() { if (isset($_SESSION['cookie']) and $_SESSION['cookie']) { return ''; } else { return '&'.SID; } } function is_admin() { if(is_logged_in($user)){ $username = base64_decode($_SESSION['user']); if ($username != "Slowman" && $username != "Rappstar" && $username != "Herbert" && $username != "Janitor" && $username != "gtvirginia" && $username != "AWright" && $username != "STConcierge") { return false; } else { return true; } } else { return false; } } //global function for checking whether user is logged in or not. //you will notice we will use it everwhere in the script. function is_logged_in($user) { global $db,$prefix; // return true if we're already logged in if (isset($_SESSION['user']) && $_SESSION['user'] != '') { return 1; } // try and get the session id if (isset($_REQUEST['gforum_1022870964_session'])) { $session_id = $_REQUEST['gforum_1022870964_session']; } else if ($_REQUEST['from'] == 'gforum') { foreach ($_COOKIE as $key => $value) { if (preg_match('/gforum.*session/', $key)) { $session_id = $value; break; } } if (! isset($session_id)) { return 0; } } // return false if we have no login info else { return 0; } $result = mysql_query("SELECT session_user_id FROM ".$prefix."Session WHERE session_id='$session_id'") or die (mysql_error()); $row = mysql_fetch_array($result); $user_id = $row['session_user_id']; $result = mysql_query("SELECT user_username,user_password,user_last_logon FROM ".$prefix."User WHERE user_id='$user_id'"); $row = mysql_fetch_array($result); $_SESSION['user'] = base64_encode($row['user_username']); $_SESSION['password'] = base64_encode($row['user_password']); $_SESSION['user_id'] = base64_encode($user_id); $_SESSION['session_id'] = $session_id; $_SESSION['cookie'] = !(isset($_REQUEST['session'])); if ($_SESSION['user_id'] == '') { return 0; } // we're now logged in, so return 1 return 1; // TODO: SLOWTWITCH CHANGE END } ?>