<?php require_once "../includes/initialize.php"; // checks if user is logged in $session->is_logged_in() ? $logged = true : ($logged = false); $top_scorers = User::find_top_scorers(); // checks if $_GET was set if (isset($_GET['nick'])) { $nick = $_GET['nick']; // searches for users place -> returns 0 based position $ranking_position = array_search($nick, $top_scorers); if ($ranking_position === false) { // no such user //redirect_to("http://wszechwiedzacy.com/ranking"); } } else { if ($logged) { $nick = $_SESSION['username']; // same as above // fix repeating? $ranking_position = array_search($nick, $top_scorers); } else { //redirect_to("http://wszechwiedzacy.pl/ranking"); } } // end of if/else session is logged in // make the user object that holds all information that is stored in database $user_exists = User::user_exists($nick); if ($user_exists) { $current_user = User::find_user($nick); $last = strtotime($current_user->last_activity); } else {