示例#1
0
function store_data()
{
    $cookie = fetch_cookie();
    # Validated for certain safety measures.
    $ua_id = get_ua();
    $tokens = param_val("tokens", "/^[:_a-zA-Z0-9 ,-]+\$/");
    global $dbhandle;
    $sql = sprintf("REPLACE INTO survey (\n      status_a, \n      status_aaaa,\n      status_ds4,\n      status_ds6,\n      status_ipv4,\n      status_ipv6,\n      status_v6ns,\n      status_v6mtu,\n      status_dsmtu,\n      \n      time_a,\n      time_aaaa,\n      time_ds4,\n      time_ds6,\n      time_ipv4,\n      time_ipv6,\n      time_v6ns,\n      time_v6mtu,\n      time_dsmtu,\n      \n      tokens,\n      ua_id,\n      \n      cookie, ip, ip4, ip6\n      \n      )\n     VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s',\n             '%s','%s','%s','%s','%s','%s','%s','%s','%s',\n             '%s','%s',\n             '%s','%s','%s','%s')", mysql_real_escape_string(fetch_status("a"), $dbhandle), mysql_real_escape_string(fetch_status("aaaa"), $dbhandle), mysql_real_escape_string(fetch_status("ds4"), $dbhandle), mysql_real_escape_string(fetch_status("ds6"), $dbhandle), mysql_real_escape_string(fetch_status("ipv4"), $dbhandle), mysql_real_escape_string(fetch_status("ipv6"), $dbhandle), mysql_real_escape_string(fetch_status("v6ns"), $dbhandle), mysql_real_escape_string(fetch_status("v6mtu"), $dbhandle), mysql_real_escape_string(fetch_status("dsmtu"), $dbhandle), mysql_real_escape_string(fetch_time("a"), $dbhandle), mysql_real_escape_string(fetch_time("aaaa"), $dbhandle), mysql_real_escape_string(fetch_time("ds4"), $dbhandle), mysql_real_escape_string(fetch_time("ds6"), $dbhandle), mysql_real_escape_string(fetch_time("ipv4"), $dbhandle), mysql_real_escape_string(fetch_time("ipv6"), $dbhandle), mysql_real_escape_string(fetch_time("v6ns"), $dbhandle), mysql_real_escape_string(fetch_time("v6mtu"), $dbhandle), mysql_real_escape_string(fetch_time("dsmtu"), $dbhandle), mysql_real_escape_string($tokens, $dbhandle), mysql_real_escape_string($ua_id, $dbhandle), mysql_real_escape_string($cookie, $dbhandle), mysql_real_escape_string(remote_addr(), $dbhandle), mysql_real_escape_string(fetch_addr("ip4"), $dbhandle), mysql_real_escape_string(fetch_addr("ip6"), $dbhandle));
    #        print $sql;
    $result = mysql_query($sql, $dbhandle);
    if (!$result) {
        $message = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $sql;
        die($message);
    }
    #  header("HTTP/1.0 204 No Content");
}
示例#2
0
function store_data_text()
{
    global $mirrorconfig;
    global $privateconfig;
    $cookie = fetch_cookie();
    # Validated for certain safety measures.
    $tokens = param_val("tokens", "/^[a-zA-Z0-9 ,]+\$/");
    if ($_POST["nobots"] != "serious") {
        header("HTTP/1.1 500 Internal server error");
        print htmlentities("nobots value wrong, received \"" . $_POST["nobots"] . "\"");
        exit(1);
    }
    if ($_POST["purpose"] == "-") {
        header("HTTP/1.1 400 Bad Request");
        print htmlentities("'purpose' must be specified to post this comment.");
        exit(1);
    }
    $message = sprintf("%-15s: %s\n", "contact", $_POST["contact"]);
    $message .= sprintf("%-15s: %s\n", "purpose", $_POST["purpose"]);
    $message .= sprintf("%-15s: %s\n", "tokens", $_POST["tokens"]);
    $message .= sprintf("%-15s: %s\n", "score_transition", $_POST["score_transition"]);
    $message .= sprintf("%-15s: %s\n", "score_strict", $_POST["score_strict"]);
    $message .= sprintf("%-15s: %s\n", "a", $_POST["a"]);
    $message .= sprintf("%-15s: %s\n", "aaaa", $_POST["aaaa"]);
    if (preg_match("/ok|slow/", $_POST["ds4"])) {
        $message .= sprintf("%-15s: %s (via ipv4)\n", "ds", $_POST["ds4"]);
    } else {
        if (preg_match("/ok|slow/", $_POST["ds6"])) {
            $message .= sprintf("%-15s: %s (via ipv6)\n", "ds", $_POST["ds6"]);
        } else {
            $message .= sprintf("%-15s: %s (via ipv4)\n", "ds", $_POST["ds4"]);
            $message .= sprintf("%-15s: %s (via ipv6)\n", "ds", $_POST["ds6"]);
        }
    }
    $message .= sprintf("%-15s: %s\n", "dsmtu", $_POST["dsmtu"]);
    $message .= sprintf("%-15s: %s\n", "ipv4", $_POST["ipv4"]);
    $message .= sprintf("%-15s: %s\n", "ipv6", $_POST["ipv6"]);
    $message .= sprintf("%-15s: %s\n", "v6mtu", $_POST["v6mtu"]);
    $message .= sprintf("%-15s: %s\n", "v6ns", $_POST["v6ns"]);
    $message .= "----------------------------\n";
    $message .= sprintf("%-15s: %s\n", "ip4", $_POST["ip4"]);
    $message .= sprintf("%-15s: %s %s\n", "ip6", $_POST["ip6"], $_POST["ip6subtype"]);
    $message .= sprintf("%-15s: %s\n", "remote_addr", remote_addr());
    $message .= sprintf("%-15s: %s\n", "user-agent", $_SERVER["HTTP_USER_AGENT"]);
    $message .= sprintf("%-15s: %s\n", "referer", $_SERVER["HTTP_REFERER"]);
    $message .= sprintf("%-15s: %s\n", "subdomain", $_POST["subdomain"]);
    $message .= "\n\nNotes\n--------------\n" . $_POST["notes"];
    if ($privateconfig["google_translate"]["enable"]) {
        $message .= "\n\nTranslated\n---------\n" . translate($_POST["notes"]);
    }
    $message .= "\n\nComments\n--------------\n" . $_POST["comments"];
    #  print_r($_SERVER);
    $charset = "UTF-8";
    #  header("Content-type: text/html; charset=$charset");
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test your IPv6.</title>
   <link REL="SHORTCUT ICON"   HREF="http://test-ipv6.com/images/favicon.ico">
  <META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php 
    $contact = trim($_POST["contact"]);
    $result = filter_var($contact, FILTER_VALIDATE_EMAIL);
    if ($result) {
        $replyto = "Reply-to: {$contact}\r\n";
    } else {
        $replyto = "";
        $contact = "";
    }
    mail($mirrorconfig["site"]["mailto"], $mirrorconfig["site"]["name"] . " feedback [{$contact}]", $message, $replyto . "Content-type: text/plain; charset={$charset}");
    print "Feedback sent; thank you for your assistance.<p>";
    print "If you included contact details, you may be contacted for further information, by " . $mirrorconfig["site"]["contact"] . "</hr>";
    print "<pre><code>";
    print "To: " . $mirrorconfig["site"]["mailto"] . "\n\n";
    print htmlentities($message, ENT_COMPAT, "UTF-8");
    print "</code></pre>";
    print "</body>";
}