You cannot 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
556 B
PHP

<?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')]);
$_SESSION['voted'][$qid] = true;
header("Location: ./r/$code/thanks");