コード例 #1
0
function getMime($file, $host = '', $port = 80)
{
    $host = $host ? $host : TM_DOMAIN;
    $host = str_replace("http://", "", $host);
    $host = str_replace("https://", "", $host);
    #return $host." | ".$file;
    $response = send_http_request("HEAD {$file} HTTP/1.0\r\nUser-Agent: \n " . TM_APPTEXT . "\r\n" . "Host: {$host}:{$port}\r\n\r\n");
    if ($response['header']['HTTP_STATUS_CODE'] == 200) {
        return $response['header']['HTTP_CONTENT-TYPE'];
    } else {
        return $response['header']['HTTP_STATUS_CODE'];
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: changgangzhang/fusionpbx
        $value = $val['var'];
    }
    if (strlen($val['text']) > 0) {
        $value = $val['text'];
    }
    $provision[$key] = $value;
    unset($value);
}
//check if provisioning has been enabled
if ($provision["enabled"] != "true") {
    echo "access denied";
    exit;
}
//send a request to a remote server to validate the MAC address and secret
if (strlen($_SERVER['auth_server']) > 0) {
    $result = send_http_request($_SERVER['auth_server'], 'mac=' . check_str($_REQUEST['mac']) . '&secret=' . check_str($_REQUEST['secret']));
    if ($result == "false") {
        echo "access denied";
        exit;
    }
}
//use the mac address to get the vendor
$device_vendor = device::get_vendor($mac);
//keep backwards compatibility
if (strlen($_SESSION['provision']["cidr"]["text"]) > 0) {
    $_SESSION['provision']["cidr"][] = $_SESSION['provision']["cidr"]["text"];
}
//check the cidr range
if (is_array($_SESSION['provision']["cidr"])) {
    $found = false;
    foreach ($_SESSION['provision']["cidr"] as $cidr) {
コード例 #3
0
 function send_http_flood($url, $time)
 {
     $EndTime = time() + $time;
     while (time() < $EndTime) {
         send_http_request($url);
     }
 }