A simple system for creating multiple-choice questions for an audience to
answer on their phones. Responses are tallied and displayed in real-time.
https://openquestion.netsyms.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
585 B
24 lines
585 B
<?php
|
|
|
|
require_once __DIR__ . "/required.php";
|
|
|
|
$qid = $VARS['qid'];
|
|
$aid = $VARS['aid'];
|
|
|
|
$code = $database->get('questions', 'qcode', ['qid' => $qid]);
|
|
|
|
if (!$database->has('answers', ["AND" => ['qid' => $qid, 'aid' => $aid]])) {
|
|
header("Location: ./r/$code/error");
|
|
die();
|
|
}
|
|
|
|
if ($_SESSION['voted'][$qid] === true) {
|
|
header("Location: ./r/$code/dejavu");
|
|
die();
|
|
}
|
|
|
|
$database->insert("responses", ['qid' => $qid, 'aid' => $aid, 'timestamp' => date('Y-m-d H:i:s'), 'name' => $_SESSION['name']]);
|
|
|
|
$_SESSION['voted'][$qid] = true;
|
|
|
|
header("Location: ./r/$code/thanks");
|