if(!ONLY_PAGE) { // STATUS CHECKER $statustimeout = 1; foreach(explode("*", str_replace(" ", "", $config['server']['statusTimeout'])) as $status_var) if($status_var > 0) $statustimeout = $statustimeout * $status_var; $statustimeout = $statustimeout / 1000; $config['status'] = parse_ini_file('cache/DONT_EDIT_serverstatus.txt'); if($config['status']['serverStatus_lastCheck']+$statustimeout < time()) { $config['status']['serverStatus_checkInterval'] = $statustimeout+3; $config['status']['serverStatus_lastCheck'] = time(); $statusInfo = new ServerStatus($config['server']['ip'], $config['server']['statusPort'], 1); if($statusInfo->isOnline()) { $config['status']['serverStatus_online'] = 1; $config['status']['serverStatus_players'] = $statusInfo->getPlayersCount(); $config['status']['serverStatus_playersMax'] = $statusInfo->getPlayersMaxCount(); $h = floor($statusInfo->getUptime() / 3600); $m = floor(($statusInfo->getUptime() - $h*3600) / 60); $config['status']['serverStatus_uptime'] = $h.'h '.$m.'m'; $config['status']['serverStatus_monsters'] = $statusInfo->getMonsters(); } else { $config['status']['serverStatus_online'] = 0; $config['status']['serverStatus_players'] = 0; $config['status']['serverStatus_playersMax'] = 0; } $file = fopen("cache/DONT_EDIT_serverstatus.txt", "w"); $file_data = ''; foreach($config['status'] as $param => $data) { $file_data .= $param.' = "'.str_replace('"', '', $data).'" '; } rewind($file); fwrite($file, $file_data); fclose($file); } //PAGE VIEWS COUNTER $views_counter = "cache/DONT_EDIT_usercounter.txt"; // checking if the file exists if (file_exists($views_counter)) { $actie = fopen($views_counter, "r+"); $page_views = fgets($actie, 9); $page_views++; rewind($actie); fputs($actie, $page_views, 9); fclose($actie); } else { // the file doesn't exist, creating a new one with value 1 $actie = fopen($views_counter, "w"); $page_views = 1; fputs($actie, $page_views, 9); fclose($actie); } }