-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpoll_vote.php
88 lines (83 loc) · 2.88 KB
/
poll_vote.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
require_once("config/config.php");
require_once("config/db_cnx.php");
require 'config/functions.php';
session_start();
if($_SESSION["user"]["id"] == "1") {
ini_set("display_errors", 1);
error_reporting(E_ALL | E_STRICT);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
}
$uservote = $_REQUEST['vote'];
$id = $_SESSION["user"]["id"];
$vote = getPollVotes();
if ($uservote == 1) {
$vote['noodles'] = $vote['noodles'] + 1;
}
if ($uservote == 2) {
$vote['pizza'] = $vote['pizza'] + 1;
}
if ($uservote == 3) {
$vote['kebap'] = $vote['kebap'] + 1;
}
if ($uservote == 4) {
$vote['schnitzel'] = $vote['schnitzel'] + 1;
}
if ($uservote == 5) {
$vote['grill'] = $vote['grill'] + 1;
}
updateVotes($vote);
$percent = getVotePercent($vote);
$update_vote = "UPDATE login SET vote = '1' WHERE id = '$id'";
$query = $mysqli->query($update_vote);
$_SESSION["user"]["vote"] = "1";
?>
<div class="row" style="margin-top: 10px;">
<div class="col-xs-3">
Noodles:
</div>
<div class="col-xs-9">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent['noodles']; ?>%; min-width: 2em;">
<?php echo $percent['noodles']; ?>%
</div>
</div>
</div>
<div class="col-xs-3">
Pizza:
</div>
<div class="col-xs-9">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent['pizza']; ?>%; min-width: 2em;">
<?php echo $percent['pizza']; ?>%
</div>
</div>
</div>
<div class="col-xs-3">
Kebap:
</div>
<div class="col-xs-9">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent['kebap']; ?>%; min-width: 2em;">
<?php echo $percent['kebap']; ?>%
</div>
</div>
</div>
<div class="col-xs-3">
Schnitzel:
</div>
<div class="col-xs-9">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent['schnitzel']; ?>%; min-width: 2em;">
<?php echo $percent['schnitzel']; ?>%
</div>
</div>
</div>
<div class="col-xs-9">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $percent['grill']; ?>%; min-width: 2em;">
<?php echo $percent['grill']; ?>%
</div>
</div>
</div>
</div>