while ($player = mysql_fetch_assoc($close_players)) { $player_data = new user($player['user_id'], $serverobj); for ($i = 0; $i < $num_of_days; $i++) { $player_data->dailyGold(); } $leaders[$player_data->calculateScore()] = $player_data; } //end while close_players krsort($leaders); $c = 0; foreach ($leaders as $leader) { $c++; $leader->setValue('rank', $c); do_facebook($leader); } //end foreach } //end if new day if ($server['week_length'] && $server['previous_week'] < time() - $server['week_length']) { echo 'RESET'; $serverobj = new server($server['server_id']); $serverobj->reset(); //TODO: highscores, etc } //end if new week } //end while servers mysql_query("UPDATE users SET session_id='' WHERE session_timeout < " . time(), $db) or die(mysql_error()); ?> DONE