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");