示例#1
0
function displayElevatorShaft($building)
{
    $elevator = $building->getElevator(0);
    ?>
<table class="elevatorshaft"><?php 
    foreach ($building->getFloorsReversed() as $aFloor) {
        if ($elevator->getFloor() == $aFloor) {
            ?>
<tr><td><div class="leftdoor" <?php 
            echo doorWidth($elevator);
            ?>
></div><div class="rightdoor" <?php 
            echo doorWidth($elevator);
            ?>
></div></td><?php 
            displayButtons($aFloor);
            displayPeople($aFloor);
            ?>
</tr><?php 
        } else {
            ?>
<tr><td></td><?php 
            displayButtons($aFloor);
            displayPeople($aFloor);
            ?>
</tr><?php 
        }
    }
    ?>
</table><?php 
}
displayPeople($result);
$conn->close();
// add new person
$newFirst = $newLast = $newPassword = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $conn = connect('crud');
    //TODO: figure out how to properly escape the inputs
    $newFirst = $_POST["firstname"];
    $newLast = $_POST["lastname"];
    $newPassword = $_POST["password"];
    $insert = "INSERT INTO people (firstname, lastname, password) \n                                VALUES ('" . $_POST["firstname"] . "', '" . $_POST["lastname"] . "', '" . $_POST["password"] . "');";
    mysqli_query($conn, $insert);
    // also echo just the new row at the bottom of table
    $q = "SELECT * FROM people ORDER BY ID DESC LIMIT 1";
    $result = mysqli_query($conn, $q);
    displayPeople($result);
    $conn->close();
}
function connect($database)
{
    $conn = "";
    $host = "127.0.0.1";
    $user = "******";
    $pass = "";
    $db = $database;
    $conn = mysqli_connect($host, $user, $pass, $db) or die(mysql_error());
    return $conn;
}
function displayPeople($result)
{
    while ($row = mysqli_fetch_assoc($result)) {
示例#3
0
}
echo "<div class='puzzleInfo'>";
// Display puzzle number, title, answer, summary, description.
displayPuzzleInfo($uid, $pid, $puzzleInfo);
// Allow testing admins to display the hidden puzzle info
if ($hidePuzzleInfo) {
    echo '<a href="#" id="showTestLink">Show Answer, Summary, and Description</a>';
    echo '<a href="#" id="hideTestLink" class="hideFromTest">Hide Answer, Summary, and Description</a>';
}
// Allow author and lurkers to edit summary and description
echo '<p class="small"><a href="' . URL . "/puzzle.php?edit&pid={$pid}" . '">';
echo 'Edit Title, Summary and Description</a></p>';
echo "</div>";
// List various people working on the puzzle
echo "<div class='peopleInfo'>";
displayPeople($uid, $pid);
echo "</div>";
// List puzzle status
echo "<div class='statusInfo'>";
displayStatus($uid, $pid);
echo "</div>";
// List puzzle notes
echo "<div class='notesInfo'>";
displayNotes($uid, $pid);
echo "</div>";
// List puzzle editor notes
echo "<div class='notesInfo'>";
displayEditorNotes($uid, $pid);
echo "</div>";
// List puzzle runtime info
echo "<div class='notesInfo'>";