Ejemplo n.º 1
0
/**
 * Generates the html for display.
 * @param	int		$id
 * @param	string	$domain
 * @param	int		$port
 * @param	int		$time
 * @param	int		$code
 * @return	string
 */
function gen_html($id, $domain, $port, $time, $code)
{
    $units = gen_units($time);
    if ($time < 1) {
        $time = $time * 1000;
    } else {
        $time = round($time, 2);
    }
    if ($time <= 0) {
        $time = "< 1";
    }
    if ($id == 1) {
        $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"" . $domain . "\" rel=\"nofollow\">" . $domain . "</a> is working <span class=\"smile\">:)</span></p>\n\n";
        $html .= "\t<p class=\"smaller\">It took " . $time . " " . $units . " for a <a href=\"http://en.wikipedia.org/wiki/List_of_HTTP_status_codes\" title=\"Wikipedia - HTTP Status Codes\">" . $code . "</a> response" . show_ip($domain) . ".</p>\n\n";
        $html .= "\t<p class=\"smaller\">Check <a href=\"/\" title=\"Home\">another site</a>" . gen_save($domain) . ".</p>\n";
    } else {
        if ($id == 2) {
            if (!empty($code) && is_numeric($code)) {
                $text = "We got a <a href=\"http://en.wikipedia.org/wiki/List_of_HTTP_status_codes\" title=\"Wikipedia - HTTP Status Codes\">" . $code . "</a> http status code" . show_ip($domain) . ".";
            }
            $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"" . $domain . "\" rel=\"nofollow\">" . $domain . "</a> seems to be down <span class=\"smile\">:(</span></p>\n\n";
            if (isset($text)) {
                $html .= "\t<p class=\"smaller\">" . $text . "</p>\n";
            }
            $html .= "\t<p class=\"smaller\">Check <a href=\"/\" title=\"Home\">another site</a>" . gen_save($domain) . ".</p>\n";
        } else {
            if ($id == 0) {
                $html = "<p>We need a valid domain to check! <a href=\"/d/" . gen_domain($domain, $port) . "\">Try again.</a></p>\n";
            }
        }
    }
    if ($domain == "isitup.org" || $domain == "127.0.0.1") {
        $html = "<p>Have a think about what you've just done. <a href=\"/\" title=\"Better luck next time.\">Try again.</a></p>\n";
    }
    return $html;
}
Ejemplo n.º 2
0
/**
 * Generates the html for display.
 *
 * @param   int     $id
 * @param   string  $domain
 * @param   int     $port
 * @param   int     $time
 * @param   int     $code
 *
 * @return  string
 */
function gen_html($id, $domain, $port, $time, $code)
{
    $units = gen_units($time);
    if ($time < 1) {
        $time = $time * 1000;
    } else {
        $time = round($time, 2);
    }
    if ($time <= 0) {
        $time = "< 1";
    }
    if ($id == 1) {
        $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"http://" . $domain . "/\" rel=\"nofollow\">" . $domain . "</a> is up.</p>\n\n";
        $html .= "\t<p class=\"smaller\">It took " . $time . " " . $units . " for a " . gen_http_wiki_link($code) . " response code" . show_ip($domain) . ".</p>\n\n";
        $html .= "\t<p class=\"smaller\"><a href=\"/\" title=\"Home\">Go back</a> to check another site" . gen_save($domain) . ".</p>\n";
    } else {
        if ($id == 2) {
            if (!empty($code) && is_numeric($code)) {
                $text = "We got a " . gen_http_wiki_link($code) . " response code" . show_ip($domain) . ".";
            }
            $html = "<p><a href=\"http://" . gen_domain($domain, $port) . "\" class=\"domain\" title=\"http://" . $domain . "/\" rel=\"nofollow\">" . $domain . "</a> seems to be down!</p>\n\n";
            if (isset($text)) {
                $html .= "\t<p class=\"smaller\">" . $text . "</p>\n";
            }
            $html .= "\t<p class=\"smaller\"><a href=\"/\" title=\"Home\">Go back</a> to check another site" . gen_save($domain) . ".</p>\n";
        } else {
            if ($id == 3) {
                $html = "<p>We need a valid domain to check! <a href=\"/d/" . gen_domain($domain, $port) . "\">Try again.</a></p>\n";
            }
        }
    }
    if ($domain == "isitup.org" || $domain == "127.0.0.1") {
        $html = "<p>Have a think about what you've just done and <a href=\"/\" title=\"Better luck next time.\">try again.</a></p>\n";
    }
    return $html;
}