Ejemplo n.º 1
0
 ***************************************/
//Should we just print the most recent time?
if (get("lastupdateonly")) {
    $result = $conn->query("SELECT * FROM questions ORDER BY utc DESC LIMIT 1");
    if ($row = $result->fetch_assoc()) {
        echo "{$row['id']}";
    }
    exit;
}
/***************************************
 * List Unanswered questions            *
 ***************************************/
$result = $conn->query("SELECT * FROM questions WHERE (answered='0' OR answered IS NULL) ORDER BY utc ASC");
$next = $conn->query("SELECT uid FROM questions WHERE (answered='0' OR answered IS NULL) ORDER BY utc ASC LIMIT 1")->fetch_row()[0];
if ($next != null) {
    $next = intval(getNameAndNumber($next)) % 100 + 1;
}
if ($next == null) {
    $next = "No Questions!";
}
if ($admin) {
    echo "<div style='border-radius: 5px' class='bg-success text-success text-center'><h1>Next: <span class='badge'><h1>&nbsp;&nbsp;{$next}&nbsp;&nbsp;</h1></span></h1></div>";
}
echo "<script>\r\n\t\tvar disableRefresh = false;\r\n\t</script>";
echo "\r\n\t<div class='bg-info'><h3>Virtual Waiting Line</h3></div>";
echo "\r\n\t<table class='table table-striped table-hover'>\r\n\t\t<thead>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>#</th>\r\n\t\t\t\t<th>Age</th>\r\n\t\t\t\t<th>Class</th>\r\n\t\t\t\t<th>Question</th>\r\n\t\t\t</tr>\r\n\t\t</thead>\r\n\t\t<tbody>";
$id = 0;
$time = time();
$firstIP = "";
while ($row = $result->fetch_assoc()) {
    $id++;
Ejemplo n.º 2
0
<?php

include_once "util.php";
/***************************************
 * List Unanswered questions            *
 ***************************************/
$result = $conn->query("SELECT * FROM questions WHERE (answered='0' OR answered IS NULL) ORDER BY utc ASC");
$next = $conn->query("SELECT uid FROM questions WHERE (answered='0' OR answered IS NULL) ORDER BY utc ASC LIMIT 1")->fetch_row()[0];
if ($next != null) {
    $next = getNameAndNumber($next);
}
if ($next == null) {
    $next = "No Questions!";
}
if ($admin) {
    echo "<div class='bg-success text-success text-center'><h1>Next: <span class='badge'><h1>&nbsp;&nbsp;{$next}&nbsp;&nbsp;</h1></span></h1></div>";
}
echo "\r\n\t<div class='bg-info'><h3>Virtual Waiting Line</h3></div>";
echo "\r\n\t<table class='table table-striped table-hover'>\r\n\t\t<thead>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>#</th>\r\n\t\t\t\t<th>Age</th>\r\n\t\t\t\t<th>Class</th>\r\n\t\t\t\t<th>Question</th>\r\n\t\t\t</tr>\r\n\t\t</thead>\r\n\t\t<tbody>";
$id = 0;
$time = time();
$firstIP = "";
while ($row = $result->fetch_assoc()) {
    $id++;
    if ($id == 1) {
        $firstIP = $row['ip'];
    }
    $timeDifference = time() - $row['utc'];
    $minutes = floor($timeDifference / 60);
    $seconds = $timeDifference % 60;
    $unansweredTime = $minutes . "m " . $seconds . "s";
Ejemplo n.º 3
0
if (isset($_GET['answer'])) {
    $addedClause = "";
    if (!$admin) {
        //Only delete where uid
        $addedClause = "AND uid={$_SESSION['uid']}";
    }
    $time = time();
    $id = $_GET['answer'];
    $conn->query("UPDATE questions SET answered={$time} WHERE (answered=0 OR answered IS NULL) AND id={$id} {$addedClause}");
}
/***************************************
 * Print the UID                        *
 ***************************************/
$number = "You haven't asked anything";
if (isset($_SESSION['uid'])) {
    $number = "You are number " . (intval(getNameAndNumber($_SESSION['uid'])) % 100 + 1);
    //(intval() % 100) + 1;
    //Did they vote?
    //$result = $conn->query("SELECT COUNT(*) FROM votes WHERE uid=0");
    //$row = $result->fetchRow();
    //echo "VOTES: " . $row[0];
}
if ($admin) {
    //Get the IP
    $url = "<br>{$_SERVER['HTTP_HOST']}<br><small>(open url in your browser)</small>";
    $number = "You are ADMIN <a href='?ilove=llamas' class='btn btn-primary'>Logout <span class='glyphicon glyphicon-log-out'></span></a>\n                                <a href='instructions.php' class='btn btn-warning' target='_blank'>Instructions</a>";
} else {
    $url = "";
}
echo "<div class='col-xs-12' style='background-color: #444; color:#fff; border-radius: 0px 0px 5px 5px'><h1>CSLC Question Queue\n                        {$url}\n\t\t\t\t\t\t<br><small>{$number}</small></h1></div><br>";
//begin the row