// Set the players online/offline status. $row['online'] = (bool) false; if ($difftime <= 5) { $row['online'] = (bool) true; } // Set the characters Insignia. $row['insignia'] = Tki\Character::getInsignia($pdo_db, $row['email'], $langvars); // This is just to show that we can set the type of player. // like: banned, admin, player, npc etc. if ($row['email'] == $tkireg->admin_mail || $row['team_admin'] === 'Y') { $row['type'] = 'admin'; } else { $row['type'] = 'player'; } // Check for banned players. $ban_result = Tki\CheckBan::isBanned($pdo_db, $row); if ($ban_result === false || array_key_exists('ban_type', $ban_result) && $ban_result['ban_type'] === ID_WATCH) { $row['banned'] = (bool) false; $row['ban_info'] = null; } else { $row['banned'] = (bool) true; $row['ban_info'] = array('type' => $ban_result['ban_type'], 'public_info' => "Player banned/locked for the following:\n{$ban_result['public_info']}"); } array_push($player_list, $row); } $template->addVariables('players', $player_list); } if (empty($_SESSION['username'])) { $variables['loggedin'] = (bool) true; $variables['linkback'] = array('caption' => $langvars['l_global_mlogin'], 'link' => 'index.php'); } else {
} $title = $langvars['l_login_title2']; // Check Banned $banned = 0; if ($playerinfo !== null && $playerfound !== false) { $res = $db->Execute("SELECT * FROM {$db->prefix}ip_bans WHERE ? LIKE ban_mask OR ? LIKE ban_mask;", array($request->server->get('REMOTE_ADDR'), $playerinfo['ip_address'])); Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__); if ($res->RecordCount() != 0) { $banned = 1; } } Tki\Header::display($pdo_db, $lang, $template, $title); echo "<h1>" . $title . "</h1>\n"; if ($playerfound) { if (password_verify($filtered_post_password, $playerinfo['password'])) { $ban_result = Tki\CheckBan::isBanned($pdo_db, $playerinfo); if ($ban_result === false || array_key_exists('ban_type', $ban_result) && $ban_result['ban_type'] === ID_WATCH) { if ($playerinfo['ship_destroyed'] == "N") { // Player's ship has not been destroyed Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_LOGIN, $request->server->get('REMOTE_ADDR')); $stamp = date("Y-m-d H:i:s"); $sql = "UPDATE {$db->prefix}ships SET last_login = ?, ip_address = ? WHERE ship_id = ?;"; $update = $db->Execute($sql, array($stamp, $request->server->get('REMOTE_ADDR'), $playerinfo['ship_id'])); Tki\Db::LogDbErrors($pdo_db, $sql, __LINE__, __FILE__); $_SESSION['logged_in'] = true; $_SESSION['password'] = $filtered_post_password; $_SESSION['username'] = $playerinfo['email']; Tki\Text::gotomain($pdo_db, $lang); // They have logged in successfully, so update their session ID as well $tki_session->regen(); header("Location: main.php");