function logout(&$ch) { curl_setopt($ch, CURLOPT_URL, "http://muachung.vn/ajax.php?act=customer&code=logout"); initCommonCURL($ch); $params = array("rand" => randomFloat()); curl_setopt($ch, CURLOPT_POST, count($params)); $fields_string = ""; foreach ($params as $key => $value) { $fields_string .= $key . '=' . urlencode($value) . '&'; } rtrim($fields_string, '&'); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); $output = curl_exec($ch); echo "logout result: " . $output . "\n"; return startsWith($output, '{"err":0,"msg":"success"'); }
echo max('hello', 0), "<br />"; echo max(0, 'hello'), "<br />"; echo count(array(1, 2, 3, 4, 5, 7, 6, 5, 4, 2, 1)), "<br />"; echo "+++++++++++++++++++++++++++++++++++++++++<br />"; $val = max('string', array(2, 5, 7), 42); echo $val; echo max(0, "hello"), "<br />"; ?> <?php function randomFloat($min = 0, $max = 1) { return $min + mt_rand() / mt_getrandmax() * ($max - $min); } var_dump(randomFloat()); var_dump(randomFloat(2, 20)); echo mt_rand(), "<br />"; for ($i = 0; $i <= 10; $i++) { echo $i, "<br />"; echo "<BR>"; } echo octdec('77'); echo "<BR>"; echo bindec('11'); echo "<BR>"; echo hexdec('11'); echo "<BR>"; //echo base_convert('77'); echo "<BR>"; echo octdec(decoct(45)); $array = array("foo" => "bar", "bar" => "foo");
echo json_encode(array('ping' => round(randomFloat(0, 50), 2))); } } break; case "get_ping": if ($_POST["type"] == "sw") { if (rand(0, 9) <= 3) { $text = array("id" => $_POST["sid"], "ping" => 0, "date" => date("2015-07-" . rand(1, 19) . " 00:00:00")); } else { $text = array("id" => $_POST["sid"], "ping" => round(randomFloat(0, 50), 2), "date" => date("Y-m-d H:i:s")); } } elseif ($_POST["type"] == "nas") { if (rand(0, 9) <= 3) { $text = array("id" => $_POST["sid"], "ping" => 0, "date" => date("2015-07-" . rand(1, 19) . " 00:00:00")); } else { $text = array("id" => $_POST["sid"], "ping" => round(randomFloat(0, 50), 2), "date" => date("Y-m-d H:i:s")); } } echo json_encode($text); break; case "test": echo json_encode(array('test' => 'tested!')); break; default: echo "wrong request"; } } else { echo "<!-- Страница мониторинга. user access={$user->getAccess()}-->"; include "monitor.php"; } } else {