function load($testing)
 {
     $dbh = getDBC();
     $sql = 'SELECT * FROM levels';
     if (!$testing) {
         $sql .= ' WHERE testing=0';
     }
     $sql .= ' ORDER BY id ASC';
     $stmt = $dbh->prepare($sql);
     $stmt->execute();
     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $this->addLevel(new LevelListItem($row['id'], $row['name'], $row['author'], $row['filename'], $row['testing']));
     }
 }
Ejemplo n.º 2
0
<form action="mod.php" method="post">
Enter password:<br />
<input type="password" name="password" /><br />
<input type="submit" value="Log in" />
</form>
<?php 
        WombatFoot();
        die;
    }
} else {
    if ($_SESSION['rwamod'] !== MOD_PASSWORD) {
        unset($_SESSION['rwamod']);
        die;
    }
}
$dbh = getDBC();
if (isset($_POST['update'])) {
    $id = 0;
    $name = '';
    $author = '';
    $filename = '';
    $testing = '';
    $sql_d = 'DELETE FROM levels WHERE id=:id';
    $stmt_d = $dbh->prepare($sql);
    $stmt_d->bindParam(':id', $id);
    $sql = 'UPDATE levels SET name=:name, author=:author, filename=:filename, testing=:testing WHERE id=:id';
    $stmt = $dbh->prepare($sql);
    $stmt->bindParam(':id', $id);
    $stmt->bindParam(':name', $name);
    $stmt->bindParam(':author', $author);
    $stmt->bindParam(':filename', $filename);