function Redirect($url) { global $debuger; $softwareInfo = getServerInfo(); $winIIS = strstr(php_uname(), 'Windows') && $softwareInfo == 'IIS'; if ($winIIS) { $str_redirect = "Refresh: 0;url=%s"; } else { $str_redirect = "Location: %s"; } header(sprintf($str_redirect, escapeCRLF($url))); if ($debuger) { $debuger->end(null, basename(__FILE__)); onPageComplete($page); } exit(1); //header("location: ".escapeCRLF($url), true, 302); //exit(1); }
<title>Task7</title> <style type="text/css"> p { color: red; } </style> </head> <body> <div> <p>Browser Information:</p> <?php echo $_SERVER['HTTP_USER_AGENT']; ?> </div> <br /> <div> <p>Server information:</p> <?php getServerInfo(); ?> </div> <br /> <div> <p>Host Information:</p> <?php echo $_SERVER['HTTP_HOST']; ?> </div> </body> </html>
$info[] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''; $info[] = '<a href="http://www.yiiframework.com/">Yii Framework</a>/' . getYiiVersion(); $info[] = @strftime('%Y-%m-%d %H:%M', time()); return implode(' ', $info); } function renderFile($_file_, $_params_ = array()) { extract($_params_); require $_file_; } $result = 1; // 1: all pass, 0: fail, -1: pass with warnings foreach ($requirements as $i => $requirement) { if ($requirement[1] && !$requirement[2]) { $result = 0; } else { if ($result > 0 && !$requirement[1] && !$requirement[2]) { $result = -1; } } if ($requirement[4] === '') { $requirements[$i][4] = ' '; } } $lang = getPreferredLanguage(); $viewFile = dirname(__FILE__) . "/views/{$lang}/index.php"; if (!is_file($viewFile)) { $viewFile = dirname(__FILE__) . '/views/index.php'; } renderFile($viewFile, array('requirements' => $requirements, 'result' => $result, 'serverInfo' => getServerInfo()));
function querySql($sql) { $dbConfig = getServerInfo(); $con = mysql_connect($dbConfig['host'], $dbConfig["username"], $dbConfig['password']); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($dbConfig["database"]); mysql_query("set names utf8", $con); $res = mysql_query($sql, $con); mysql_close($con); return $res; }
<?php function getServerInfo($array) { $html = ''; foreach ($array as $key => $value) { $html .= "<li>{$key} ======> {$value}</li>"; } return $html; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Task 7</title> </head> <body> <ul> <?php echo getServerInfo($_SERVER); ?> </ul> </body> </html>
//Classic #1 – csgo.ezpz.cz:27016 echo getServerInfo('csgo.ezpz.cz', '27016', $translation); //Classic #2 – csgo.ezpz.cz:27015 echo getServerInfo('csgo.ezpz.cz', '27015', $translation); //Dust2 ONLY #1 – csgo2.ezpz.cz:27015 echo getServerInfo('csgo2.ezpz.cz', '27015', $translation); //Dust2 ONLY #2 – csgo2.ezpz.cz:27015 echo getServerInfo('csgo.ezpz.cz', '40015', $translation); //AIM+AWP #1 – csgo.ezpz.cz:27018 echo getServerInfo('csgo.ezpz.cz', '27018', $translation); //AIM+AWP #2 – csgo.ezpz.cz:27018 echo getServerInfo('csgo.ezpz.cz', '40016', $translation); //AWP – csgo2.ezpz.cz:27020 echo getServerInfo('csgo2.ezpz.cz', '27020', $translation); //ARENA 1vs1 – csgo2.ezpz.cz:27030 echo getServerInfo('csgo2.ezpz.cz', '27030', $translation); $time_elapsed_secs = microtime(true) - $start; debug_to_console("Servery cez query - " . $time_elapsed_secs); $start = microtime(true); //} //$conn = null; //MINECRAFT //$port= '25915'; //$host= 'mc.ezpz.cz'; //$status = new MinecraftServerStatus(); //$response = $status->getStatus($host,$port, '1.7.*'); //if ($response) { // echo '<tr class="server"> // <td class="icon"><img title="Minecraft" width="16" height="16" src="'; // echo $response['favicon']; // echo '" /></td>
require_once 'functions.php'; function sendMail($text, $to) { $headers = array(); $headers[] = "MIME-Version: 1.0"; $headers[] = "Content-type: text/plain; charset=utf-8"; $headers[] = "From: " . CERTMON_EMAIL; $headers[] = "Reply-To: " . CERTMON_ADMIN; $headers[] = "X-Mailer: PHP/" . phpversion(); mail($to, "Expirujici certifikaty", $text, implode("\r\n", $headers)); } $servers = getListFromCSV(); $problems = array(); foreach ($servers as $server) { $test = getServerInfo($server[0], $server[2], $server[1]); $time = time(); if ($test["status"] != 0) { } elseif ($test["cert"]["validTo_time_t"] < $time) { $problems[$server[3]][] = " " . $server[0] . ":" . $server[2] . " - " . $server[1] . " - vyexpiroval"; } elseif ($test["cert"]["validTo_time_t"] - CERTMON_SEND_BEFORE * 24 * 3600 < $time) { $problems[$server[3]][] = " " . $server[0] . ":" . $server[2] . " - " . $server[1] . " - za " . round(($test["cert"]["validTo_time_t"] - $time) / 3600 / 24 + 1) . " dní vyexpiruje"; } } if (count($problems) > 0) { foreach ($problems as $admin => $error_servers) { $text = "Dobrý den,\r\n"; $text .= "omlouvám se, ale vyexpirovaly / brzy vyexpirují některé vámi-spravované certifikáty. Konkrétně to jsou:\r\n\r\n"; $text .= implode("\r\n", $error_servers); $text .= "\r\n\r\n"; $text .= "Děkuji za brzkou nápravu, CertMonBot.";
public function checkServerInfo() { echo getServerInfo(); }
call_user_func($service . '_info'); } } } } if (!isset($_GET['call'])) { header("Content-Type: text/plain"); echo "ERROR: No service specified\n"; getHelp(); exit; } else { $service = $_GET['call']; } switch ($service) { case 'version': header("Content-Type: text/plain"); echo $VERSION; exit; case 'help': header("Content-Type: text/plain"); getHelp(); break; case 'phpinfo': echo phpinfo(); break; case 'serverinfo': echo getServerInfo(); break; default: call_service($service); }
} // Remove user $remove = getParam('remove'); if (!isNullOrEmptyString($remove)) { // any value is accepted (no need to set 'true' or 'yes' like 'remove=true') if (!removeUser($user, $pass)) { setServerError("Failed to remove user {$user}."); return; } setServerResponse("Ok, removed user {$user}."); return; } // server info for admin only $serverInfo = getParam('serverInfo'); if (!isNullOrEmptyString($serverInfo)) { $info = getServerInfo($user); if ($info == '') { setServerError("Failed to get details on the server for user {$user}."); return; } setServerResponse($info); return; } // server info for admin only $phpInfo = getParam('phpInfo'); if (!isNullOrEmptyString($phpInfo)) { if (!preg_match('/admin/i', $user)) { setServerError("Failed to get php infos (not allowed) for user {$user}."); return; } phpinfo();
} elseif ($server_id === "notunique") { echo json_encode(getServerStatsNotUnique($db_ip, $db_port, $db_login, $db_pass, 'soe-hlstats', $from, $to)); } else { echo json_encode(getServerStats($db_ip, $db_port, $db_login, $db_pass, 'soe-hlstats', $from, $to, $server_id)); } } else { //$ip = filter_input(INPUT_GET, 'ip', FILTER_SANITIZE_SPECIAL_CHARS); //$port = filter_input(INPUT_GET, 'port', FILTER_SANITIZE_SPECIAL_CHARS); //$out = ""; //$out = getServerInfo($ip, $port); ////Classic #1 – csgo.ezpz.cz:27016 //$out = getServerInfo("csgo.ezpz.cz", 27016); //Classic #1 – csgo.ezpz.cz:27015 //$out .= getServerInfo("csgo.ezpz.cz", "27015"); //Dust2 ONLY – csgo2.ezpz.cz:27015 //$out .= getServerInfo("csgo2.ezpz.cz", 27015); ////AIM+AWP – csgo.ezpz.cz:27018 //$out .= getServerInfo("csgo.ezpz.cz", "27018"); //AIM+AWP DM – csgo2.ezpz.cz:27020 //$out .= getServerInfo("csgo2.ezpz.cz", 27020); //ARENA 1vs1 – csgo2.ezpz.cz:27030 //$out .= getServerInfo("csgo2.ezpz.cz", 27030); ////IDLE #1 – csgo.ezpz.cz:30016 $out = ""; for ($i = 30015; $i <= 30024; $i++) { //for ($i = 30024; $i >= 30015; $i--) { $out .= getServerInfo('csgo.ezpz.cz', $i, $translation); } //echo ($out); echo json_encode($out); }