-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewVotingResult.php
executable file
·67 lines (62 loc) · 2.56 KB
/
viewVotingResult.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
<!DOCTYPE html>
<html>
<?php
if(strpos($_SERVER['HTTP_USER_AGENT'], "iPhone") || strpos($_SERVER['HTTP_USER_AGENT'], "Android")){
header( 'Location: sp/index.php' ) ;
}
session_start();
?>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/google-chart.js"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart_at_home);
</script>
<meta charset="utf-8">
<!-- default css -->
<link rel="stylesheet" media="all" type="text/css" href="css/style.css" />
<!-- tablest css -->
<link rel="stylesheet" media="all" type="text/css" href="css/tablet.css" />
<!-- smartphones css -->
<link rel="stylesheet" media="all" type="text/css" href="css/smart.css" />
<title>Meetrix "Meeting Management System"</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<?php
session_start();
/*initial connection to database*/
$host="localhost"; // Host name
$username='root'; // Mysql username
$password='Menu6Rainy*guilt'; // Mysql password
$db_name='meetrix_database'; // Database name
$tbl_name='meeting'; // Table name
$pdo = new PDO("mysql: host=$host; dbname=$db_name", "$username", "$password");
$votingId = $_SESSION["votingId"];
/*get voting information by vote id*/
$st1 = $pdo->query("SELECT *
FROM `vote_result`
INNER JOIN `result` ON `vote_result`.result_id=`result`.result_id
INNER JOIN `votes` ON `vote_result`.vote_id=`votes`.vote_id
WHERE `vote_result`.vote_id=". $votingId . ";");
$posts = $st1->fetchAll();
?>
<script type="text/javascript">
var jArray= <?php echo json_encode($posts); ?>;
</script>
</head>
<!-- Display result of voting using google chart API -->
<body onload="drawVoting_Result(jArray)">
<div class="charts" id="chart_pallet">
</div>
</body>
</html>