-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanswer_poll.php
35 lines (25 loc) · 992 Bytes
/
answer_poll.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include_once('database/connection.php');
include_once('database/polls.php');
include_once('database/questions.php');
include_once('database/answers.php');
include_once('database/poll_answers.php');
include('lock.php');
include('templates/header.php');
include('templates/navbar.php');
include('templates/validation/answer_poll_validation.php');
if(isset($_GET['id'])) {
$params = ['db' => $db, 'user_id' => $_SESSION['myid'], 'id' => $_GET['id']];
$check = checkIfUserAnswered($params);
if($check) {
$_SESSION['message'] = "You've already answered to this poll. Thanks.";
header("location: user.php?" . $_SERVER['QUERY_STRING']);
}
$result = getPollById($params);
$questions = getPollQuestions($params);
}
?>
<form role="form" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<?php include_once('templates/answer_poll.php'); ?>
</form>
<?php include('templates/footer.php'); ?>