-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
72 lines (67 loc) · 2.26 KB
/
index.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
<html>
<head>
<title>RC24 + Everybody Votes!</title>
<?php
define('IN_PAGE', true);
// Used to only show poll results X days old. This can be used to only show polls
// that have fallen off of the channel to keep people using the channel and not just
// check the page for results.
$day_delay = 20;
require 'includes/functions.php';
require 'includes/tables.php';
require 'includes/mappings.php';
require 'config/config.php';
?>
<link rel="stylesheet" href="./css/styles.css" type="text/css">
</head>
<body>
<div class="banner"></div>
<?php
$conn = connectMySQL();
$lid = '1';
if (isset($_GET['lid'])) {
$lid = $_GET['lid'];
}
$page = '1';
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$q = '';
if (isset($_GET['q'])) {
$q = $_GET['q'];
}
if(isset($_GET['qid'])) {
$qid = (int) $_GET['qid'];
$cid = (int) $_GET['cid'];
$question = getQuestion($qid);
if ($question) {
$type = $question['type'];
questionTable($question);
$countries = getQuestionCountries($qid);
questionCountryTable($qid, $countries, $cid);
$data = getVotesForQuestion($qid, $cid);
$vote_data = generateVoteData($data);
voteBreakDownTable('Total Votes', 'votes', $vote_data['votes_choice1'], $vote_data['votes_choice2']);
voteBreakDownTable('Male Vote', 'male', $vote_data['male_votes_choice1'], $vote_data['male_votes_choice2']);
voteBreakDownTable('Female Vote', 'female', $vote_data['female_votes_choice1'], $vote_data['female_votes_choice2']);
predictionAccuracyTable($type, $vote_data['prediction_accuracy'], $vote_data['prediction_accuracy_width']);
} else {
echo '<div class="table">Question not found</div>';
}
echo '<div class="table"><a class="button" href="./?'.urlParams().'"><< Back</a></div>';
} else {
langaugeTable();
pageButtons();
$data = questionsList();
foreach($data as $row) {
questionTable($row);
}
pageButtons();
}
?>
<div class="banner"></div>
</body>
<?php
$conn->close();
?>
</html>