$display_page_title = 'Visits log'; require_once dirname(dirname(__FILE__)) . '/CMS/index.inc'; $site = new siteinfo(); $connection = $site->connect_to_db(); $randomkey_name = 'randomkey_user'; $viewerid = (int) getUserID(); $allow_view_user_visits = false; if (isset($_SESSION['allow_view_user_visits'])) { if ($_SESSION['allow_view_user_visits'] === true) { $allow_view_user_visits = true; } } // in any case you need to be logged in to view the visits log if ($viewerid === 0) { echo '<p class="first_p">You need to login in order to view the visits log!</p>'; $site->dieAndEndPageNoBox(); } // only allow looking when having the permission if ($allow_view_user_visits === false) { $site->dieAndEndPageNoBox('You (id=' . sqlSafeString($viewerid) . ') have no permissions to view the visits log!'); } // form letting search for ip-address, host or name // this form is considered not to be dangerous, thus no key checking at all and also using the get method echo "\n" . '<form enctype="application/x-www-form-urlencoded" method="get" action="./" class="search_bar">' . "\n"; // input string echo '<div style="display:inline" class="search_bar_text"><label for="visit_search_string">Search for:</label> ' . "\n"; echo '<span>'; if (isset($_GET['search'])) { $site->write_self_closing_tag('input type="text" title="use * as wildcard" id="visit_search_string" name="search_string" value="' . $_GET['search_string'] . '"'); } else { $site->write_self_closing_tag('input type="text" title="use * as wildcard" id="visit_search_string" name="search_string"');
} // if the viewer is leader of a team, a value other than 0 will be the result of the query // and that value will be the id of the team the viewer is leader while ($row = mysql_fetch_array($result)) { $leader_of_team_with_id = $row['id']; } } // users are not supposed to invite themselves if (($allow_invite_in_any_team || $leader_of_team_with_id > 0 && $viewerid !== $profile) && strcmp($suspended_status, 'deleted') !== 1) { echo '<a class="button" href="?invite=' . htmlspecialchars(urlencode($profile)) . '">Invite player to team</a>' . "\n"; } if (isset($_SESSION['allow_view_user_visits']) && $_SESSION['allow_view_user_visits'] === true && strcmp($suspended_status, 'deleted') !== 1) { echo '<a class="button" href="../Visits/?profile=' . htmlspecialchars($profile) . '">View visits log</a>' . "\n"; } } $site->dieAndEndPageNoBox(); } // display overview // form letting search for team name or time // this form is considered not to be dangerous, thus no key checking at all and also using the get method echo "\n" . '<form enctype="application/x-www-form-urlencoded" method="get" action="./" class="search_bar">' . "\n"; // input string echo '<div style="display:inline" class="search_bar_text"><label for="player_search_string">Search for:</label> ' . "\n"; echo '<span>'; if (isset($_GET['search'])) { $site->write_self_closing_tag('input type="text" title="use * as wildcard" id="player_search_string" name="search_string" value="' . $_GET['search_string'] . '"'); } else { $site->write_self_closing_tag('input type="text" title="use * as wildcard" id="player_search_string" name="search_string"'); } echo '</span></div> ' . "\n"; // looking for either team name or time