Warning: Undefined array key "HTTPS" in /var/www/sumscool.ca/html/SiteRoot.php on line 21
Hits: 642

List

Try: /ViewFile.php?path=ViewFile.php -- Online


<?php

    global $DB_DEBUG;
    $DB_DEBUG = false;

    if ($_SERVER['DOCUMENT_ROOT'] == "") { 
        require_once "/var/www/sumscool.ca/html/SiteRoot.php";
    } else {
        require_once $_SERVER['DOCUMENT_ROOT'] . "/SiteRoot.php";
    }

?>

<html>
    <head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />        
        <style>
            table {
                border: 4px solid #f58220;
                border-collapse;
            }
            td {
                min-width: 40; 
                outline-style: solid;
                outline-width: 1px;
                outline-color: #f58220;
            }
        </style>
    </head>

    <body style="background-color: #7F7F7F">
<?php 
global $HOME_IP; 
//if (strcmp($_SERVER['REMOTE_ADDR'],$HOME_IP) != 0) die("unauthorized"); 
?>
<!--
All scraping is prohibited without a valid scraping licence. Licences for scraping are available from tim.devries@yahoo.ca at the cost of $5 CAD, PayPal or E-Transfer.<br />
-->
<?php
    global $z, $s, $t;

if (isset($_REQUEST['z'])) $z = $_REQUEST['z'];
if ($z == '') $z = "0";

if (isset($_REQUEST['s'])) $s = $_REQUEST['s'];
if ($s == '') $s = "0"; 

if (isset($_REQUEST['t'])) $t = $_REQUEST['t'];
if ($t == '') $t = "0";

GLOBAL $METHOD;
if (isset($_REQUEST['method'])) $METHOD = $_REQUEST['method'];
else $METHOD = "mb_chr";

function decrementHex($hex) {
    if ($hex == "10") return "F";
    if ($hex == 0) return "F";
    if ($hex == 1) return "0";
    if ($hex == 2) return "1";
    if ($hex == 3) return "2";
    if ($hex == 4) return "3";
    if ($hex == 5) return "4";
    if ($hex == 6) return "5";
    if ($hex == 7) return "6";
    if ($hex == 8) return "7";
    if ($hex == 9) return "8";
    if ($hex == 10) return "9";
    if ($hex == 11) return "A";
    if ($hex == 12) return "B";
    if ($hex == 13) return "C";
    if ($hex == 14) return "D";
    if ($hex == 15) return "E";
}

function incrementHex($hex) {
    if ($hex == 16) return "10";
    if ($hex == 0) return "1";
    if ($hex == 1) return "2";
    if ($hex == 2) return "3";
    if ($hex == 3) return "4";
    if ($hex == 4) return "5";
    if ($hex == 5) return "6";
    if ($hex == 6) return "7";
    if ($hex == 7) return "8";
    if ($hex == 8) return "9";
    if ($hex == 9) return "A";
    if ($hex == 10) return "B";
    if ($hex == 11) return "C";
    if ($hex == 12) return "D";
    if ($hex == 13) return "E";
    if ($hex == 14) return "F";
    if ($hex == 15) return "0";
}

function toDecimal($hex) {
    if ($hex == "10") return 16;
    if ($hex == "F") return 15;
    if ($hex == "E") return 14;
    if ($hex == "D") return 13;
    if ($hex == "C") return 12;
    if ($hex == "B") return 11;
    if ($hex == "A") return 10;
    if ($hex == "9") return 9;
    if ($hex == "8") return 8;
    if ($hex == "7") return 7;
    if ($hex == "6") return 6;
    if ($hex == "5") return 5;
    if ($hex == "4") return 4;
    if ($hex == "3") return 3;
    if ($hex == "2") return 2;
    if ($hex == "1") return 1;
    if ($hex == "0") return 0;
    if ($hex == "") return 0;
}

function toHex($i = "") {
    if ($i >= 0 && $i <= 9) return $i;
    if ($i == 10) return "A";
    if ($i == 11) return "B";
    if ($i == 12) return "C";
    if ($i == 13) return "D";
    if ($i == 14) return "E";
    if ($i == 15) return "F";
    if ($i == 16) return "10";
}

function toUnicode($str = "") {
    return mb_chr($str);
}

function getNext($target) {
    if ($target == "10") return 0;
    if ($target == "0") return "1";
    if ($target == "1") return "2";
    if ($target == "2") return "3";
    if ($target == "3") return "4";
    if ($target == "4") return "5";
    if ($target == "5") return "6";
    if ($target == "6") return "7";
    if ($target == "7") return "8";
    if ($target == "8") return "9";
    if ($target == "9") return "A";
    if ($target == "A") return "B";
    if ($target == "B") return "C";
    if ($target == "C") return "D";
    if ($target == "D") return "E";
    if ($target == "E") return "F";
    if ($target == "F") return "0";
}

function getPrevious($target) {
    if ($target == "10") return "F";
    if ($target == "F") return "E";
    if ($target == "E") return "D";
    if ($target == "D") return "C";
    if ($target == "C") return "B";
    if ($target == "B") return "A";
    if ($target == "A") return "9";
    if ($target == "9") return "8";
    if ($target == "8") return "7";
    if ($target == "7") return "6";
    if ($target == "6") return "5";
    if ($target == "5") return "4";
    if ($target == "4") return "3";
    if ($target == "3") return "2";
    if ($target == "2") return "1";
    if ($target == "1") return "0";
    if ($target == "0") return "F";
}

function decrement($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    $t = getPrevious($t);
    if ($t == "F") {
        $s = getPrevious($s);
        if ($s == "F") {
            if ($z == "0") {
                $z = "10";
            } else if ($z == "10") {
                $z = "F";
            } else {
                $z = getPrevious($z);
            }
        } 
    }
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

function decrementS($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    $s = getPrevious($s);
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

function decrementT($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    $t = getPrevious($t);
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

function decrementZ($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    if ($z == "0") {
        $z = "10";
    } else if ($z == "10") {
        $z = "F";
    } else {
        $z = getPrevious($z);
    }
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

function getInt($hex = "") {
    if (strcmp($hex,"A") == 0) return 10;
    else if (strcmp($hex,"B") == 0) return 11;
    else if (strcmp($hex,"C") == 0) return 12;
    else if (strcmp($hex,"D") == 0) return 13;
    else if (strcmp($hex,"E") == 0) return 14;
    else if (strcmp($hex,"F") == 0) return 15;
    else if (strcmp($hex,"a") == 0) return 10;
    else if (strcmp($hex,"b") == 0) return 11;
    else if (strcmp($hex,"c") == 0) return 12;
    else if (strcmp($hex,"d") == 0) return 13;
    else if (strcmp($hex,"e") == 0) return 14;
    else if (strcmp($hex,"f") == 0) return 15;
    else return (int) $hex;
}

function increment($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    $t = getNext($t);
    if ($t == "0") {
        $s = getNext($s);
        if ($s == "0") {
            if ($z == "F") {
                $z = "10";
            } else if ($z == "10") {
               $z = "0";
            } else {
                $z = getNext($z);
            }
        }
    }
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

function incrementS($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    $s = getNext($s);
    return "z=$z&sa=$s&t=$t&method=$METHOD";
}

function incrementT($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    $t = getNext($t);
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

function incrementZ($z = "0", $s = "0", $t = "0") {
    global $METHOD;
    if ($z == "F") {
        $z = "10";
    } else if ($z == "10") {
        $z = "0";
    } else {
        $z = getNext($z);
    }
    return "z=$z&s=$s&t=$t&method=$METHOD";
}

    global $SELF, $METHOD, $z, $s, $t;
    $prev = $SELF . "?" . decrement($z, $s, $t);
    $next = $SELF . "?" . increment($z, $s, $t);

print("Z: "); 
for($i = 0; $i < 16; $i++) {
    if (strcmp(toHex($i),$z) == 0) {
        $link = "<a href='$SELF?z=".toHex($i) . "&s=$s&t=$t&method=$METHOD' style='color:red'>" . toHex($i) . "</a>";
    } else {
        $link = "<a href='$SELF?z=" . toHex($i) . "&s=$s&t=$t&method=$METHOD'>" . toHex($i) . "</a>";
    }
    echo $link . "&nbsp;&nbsp;"; 
}
if ($z == "10") {
    $link = "<a href='$SELF?z=10&s=$s&t=$t&method=$METHOD' style='color:red'>" . toHex($i) . "</a>";
} else {
    $link = "<a href='$SELF?z=10&s=$s&t=$t&method=$METHOD'>" . toHex($i) . "</a>";
}
echo $link . "&nbsp;&nbsp;"; 
echo "<br />";

print("S: "); 
for($i = 0; $i < 16; $i++) {
    if (strcmp(toHex($i),$s) == 0) {
         $link = "<a href='$SELF?z=$z&s=" . toHex($i) . "&t=$t&method=$METHOD' style='color:red'>" . toHex($i) . "</a>";
    } else {
        $link = "<a href='$SELF?z=$z&s=" . toHex($i) . "&t=$t&method=$METHOD'>" . toHex($i) . "</a>";
    }
    echo $link . "&nbsp;&nbsp;"; 
}
echo "<br />";

print("T: "); 
for($i = 0; $i < 16; $i++) {
    if (strcmp(toHex($i),$t) == 0) {
         $link = "<a href='$SELF?z=$z&s=$s&t=" . toHex($i) . "&method=$METHOD' style='color:red'>" . toHex($i) . "</a>";
    } else {
         $link = "<a href='$SELF?z=$z&s=$s&t=" . toHex($i) . "&method=$METHOD'>" . toHex($i) . "</a>";
    }
    echo $link . "&nbsp;&nbsp;"; 
}
echo "<br />";
?>
<br />
<a href="<?php echo $prev; ?>">Previous</a> ::
    <?php
        global $SELF, $METHOD, $z, $s, $t;
        echo "<a href='$SELF?" . decrementZ($z,$s,$t) . "'>Z</a>";
    ?>
 : 
    <?php
        global $SELF, $METHOD, $z, $s, $t;
        echo "<a href='$SELF?" . decrementS($z,$s,$t) . "'>S</a>";
    ?>
 : 
    <?php
        global $SELF, $METHOD, $z, $s, $t;
        echo "<a href='$SELF?" . decrementT($z,$s,$t) . "'>T</a>";
    ?>

-- <a href="<?php echo $next; ?>">Next</a> ::
    <?php
        global $SELF, $METHOD, $z, $s, $t;
        echo "<a href='$SELF?" . incrementZ($z,$s,$t) . "'>Z</a>";
    ?>
 : 
    <?php
        global $SELF, $METHOD, $z, $s, $t;
        echo "<a href='$SELF?" . incrementS($z,$s,$t) . "'>S</a>";
    ?>
 :  
    <?php
        global $SELF, $METHOD, $z, $s, $t;
        echo "<a href='$SELF?" . incrementT($z,$s,$t) . "'>T</a>";
    ?>

<?php
    global $SELF, $METHOD, $z, $s, $t;
    $line = "";
    if ($z == "10") $zDec = 16 * 256 * 256;
    else $zDec = toDecimal($z) * 65536;
    //echo "$" . "zDec: $zDec<br />";
//    echo "&amp;#" . $z . $s . $t . "xx;";
//    echo "<hr />";
    echo "<br />";
    echo "<br />";
    echo "Method: ";
    if (strcmp($METHOD,"mb_chr") == 0) {
         echo "<a href='$SELF?z=$z&s=$s&t=$t&method=mb_chr' style='color:red'>mb_chr()</a>&nbsp;&nbsp;";
    } else {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=mb_chr'>mb_chr()</a>&nbsp;&nbsp;";
    }
    if (strcmp($METHOD,"entity") == 0) {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=entity' style='color:red'>Entity (Hex)</a>&nbsp;&nbsp;";
    } else {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=entity'>Entity (Hex)</a>&nbsp;&nbsp;";
    }
    if (strcmp($METHOD,"decimal") == 0) {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=decimal' style='color:red'>Entity (Decimal)</a>&nbsp;&nbsp;";
    } else {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=decimal'>Entity (Decimal)</a>&nbsp;&nbsp;";
    }
    if (strcmp($METHOD,"decimalBOLD") == 0) {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=decimalBOLD' style='color:red'>BOLD (Decimal)</a>&nbsp;&nbsp;";
    } else {
        echo "<a href='$SELF?z=$z&s=$s&t=$t&method=decimalBOLD'>BOLD (Decimal)</a>&nbsp;&nbsp;";
    }
    echo "<br />";
    echo "<br />";
    echo "<table colspan='17' rowspan='17'>\n"; 
    echo "<thead>\n";
    echo "    <td>U</td>";
    echo "    <td>V-0</td>";
    echo "    <td>V-1</td>";
    echo "    <td>V-2</td>";
    echo "    <td>V-3</td>";
    echo "    <td>V-4</td>";
    echo "    <td>V-5</td>";
    echo "    <td>V-6</td>";
    echo "    <td>V-7</td>";
    echo "    <td>V-8</td>";
    echo "    <td>V-9</td>";
    echo "    <td>V-A</td>";
    echo "    <td>V-B</td>";
    echo "    <td>V-C</td>";
    echo "    <td>V-D</td>";
    echo "    <td>V-E</td>";
    echo "    <td>V-F</td>\n";
    echo "</thead>\n";

    for($u = 0; $u < 16; $u++) {
        echo "<tr>\n";
        echo "    <td>";
        echo "         <b>" . toHex($u) . ":</b> ";
        echo "    </td>";
        for($v = 0; $v < 16; $v++) {
            echo "    <td style='background-color: #ffffff' align='center'>";
            if ($METHOD == "mb_chr") {
                $s = getInt($s);
                $t = getInt($t);
                $u = getInt($u);
                $v = getInt($v);
                echo mb_chr( $zDec + ($s * 256 * 16) + ($t * 256) + ($u * 16) + $v, 'UTF-8');
            } else if ($METHOD == "entity") {
                echo "&#" . $z . $s . $t . $u . $v;
            } else if ($METHOD == "decimal") {
                echo "&#" . ($zDec + (toDecimal($s) * 16 * 256) + (toDecimal($t) * 256) + (toDecimal($u) * 16) + toDecimal($v));
            } else if ($METHOD == "decimalBOLD") {
                echo "&#" . ($zDec + (toDecimal($s) * 16 * 256) + (toDecimal($t) * 256) + (toDecimal($u) * 16) + toDecimal($v));
            }
            echo "    </td>\n";
        }
        echo "</tr>\n";
    }
    echo "</table>";
//    echo "<hr />";
?>
    </body>
</html>