function multiDB() { $db_connection = masterConnect(); $sql = "SELECT `sid`,`dbid`,`type` FROM `servers`;"; $db = $db_connection->query($sql); if ($db->num_rows == 1) { $iamDB = $db->fetch_object(); $_SESSION['multiDB'] = false; $_SESSION['server_type'] = $iamDB->type; $_SESSION['dbid'] = $iamDB->dbid; } else { $_SESSION['multiDB'] = true; } }
if (isset($_GET['searchText'])) { $search = $_GET['searchText']; } require_once "gfunctions.php"; include "classes/update.php"; $url = parse_url($_SERVER['REQUEST_URI']); $url['path'] = str_replace('.php', '', $url['path']); $url['path'] = explode('/', $url['path']); $url['path'][$settings['base']] = strtolower($url['path'][$settings['base']]); if (count($url['path']) > $settings['base'] + 1 && $url['path'][$settings['base'] + 1] != '') { $query = true; $url['path'][$settings['base'] + 1] = str_replace("%20", " ", $url['path'][$settings['base'] + 1]); } else { $query = false; } $db_connection = masterConnect(); $currentPage = $url['path'][$settings['base']]; if (isset($_GET["page"])) { $pageNum = clean($_GET["page"], 'int'); if ($pageNum < 1) { $pageNum = 1; } } else { $pageNum = 1; } $key = 0; foreach ($settings['plugins'] as &$plugin) { if (file_exists("plugins/" . $plugin . "/plugin.json")) { if (file_exists("plugins/" . $plugin . "/init.php")) { include "plugins/" . $plugin . "/init.php"; }
public function signIn() { $settings = (require 'config/settings.php'); if ($settings['steamlogin']) { require_once 'openid.php'; $openid = new LightOpenID($settings['url']); if (!$openid->mode) { $openid->identity = 'http://steamcommunity.com/openid'; header('Location: ' . $openid->authUrl()); } elseif ($openid->mode == 'cancel') { print 'User has canceled authentication!'; } else { if ($openid->validate()) { preg_match("/^http:\\/\\/steamcommunity\\.com\\/openid\\/id\\/(7[0-9]{15,25}+)\$/", $openid->identity, $matches); $_SESSION['playerid'] = $matches[1]; $db_connection = masterConnect(); $sql = "SELECT user_name, user_email, user_level, user_profile, permissions, user_password_hash, user_id\n FROM users WHERE playerid = '" . $_SESSION['playerid'] . "';"; $result_of_login_check = $db_connection->query($sql); if ($result_of_login_check->num_rows == 1) { $result_row = $result_of_login_check->fetch_object(); if ($result_row->user_level != 0) { $_SESSION['user_name'] = $result_row->user_name; $_SESSION['user_level'] = $result_row->user_level; $_SESSION['user_profile'] = $result_row->user_profile; $_SESSION['user_email'] = $result_row->user_email; $_SESSION['user_id'] = $result_row->user_id; $_SESSION['permissions'] = json_decode($result_row->permissions, true); if (isset($result_row->items)) { $_SESSION['items'] = $result_row->items; } else { $_SESSION['items'] = $settings['items']; } if (isset($_POST['lang'])) { $_SESSION['lang'] = $_POST['lang']; } $_SESSION['user_login_status'] = 1; $_SESSION['steamsignon'] = false; //used to determine if its a single sign on with no account multiDB(); logAction($_SESSION['user_name'], 'Successful Steam Login (' . $_SERVER['REMOTE_ADDR'] . ')', 2); } else { $this->errors[] = "User is banned."; logAction($_POST['user_name'], 'Steam Login Failed - Banned User (' . $_SERVER['REMOTE_ADDR'] . ')', 3); } } else { if ($settings['annonlogin']) { $permissions = (require 'config/permissions.php'); $steam = $this->GetPlayerSummaries($_SESSION['playerid']); $_SESSION['user_name'] = $steam->personaname; $_SESSION['user_level'] = 1; $_SESSION['user_profile'] = $steam->avatarmedium; $_SESSION['permissions'] = $permissions[1]; $_SESSION['items'] = $settings['items']; $_SESSION['user_login_status'] = 1; $_SESSION['profile_link'] = $steam->profileurl; $_SESSION['steamsignon'] = true; //used to determine if its a single sign on with no account multiDB(); logAction($_SESSION['user_name'], 'Successful Steam Login (' . $_SERVER['REMOTE_ADDR'] . ')', 2); } else { errorMessage(7); } } header('Location: ' . $settings['url']); exit; } else { print 'Error'; } } } }