query("SELECT * FROM enigma WHERE id = 1");
$r = $req -> fetchAll(PDO::FETCH_ASSOC);
if(isset($_POST['send'])) {
if($user['perm'] >= 2) {
if(isset($_POST['answer']) AND !empty($_POST['answer'])) {
$ans = htmlspecialchars($_POST['answer']);
$req = $db->prepare("UPDATE enigma SET answer = ? WHERE id = 1");
$req->execute(array($ans));
}
if(isset($_POST['points']) AND !empty($_POST['points'])) {
$point = (int) htmlspecialchars($_POST['points']);
$req = $db->prepare("UPDATE enigma SET point = ? WHERE id = 1");
$req->execute(array($point));
}
if(isset($_POST['team']) AND !empty($_POST['team'])) {
switch (htmlspecialchars($_POST['team'])) {
case "t":
$t_int = NULL;
break;
case "t0":
$t_int = 0;
break;
case "t1":
$t_int = 1;
break;
}
$req = $db->prepare("UPDATE enigma SET team = ? WHERE id = 1");
$req->execute(array($t_int));
}
header('Refresh:0');
}
}
?>
Admin / Enigma
ID (db)
| Answer
| Points
| Team
|
= $r[0]['id'] ?> |
= $r[0]['answer'] ?> |
= $r[0]['point'] ?> |
|