-
Notifications
You must be signed in to change notification settings - Fork 0
/
visitor.php
109 lines (99 loc) · 3.13 KB
/
visitor.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!doctype html>
<?php
if(isset($_COOKIE["access"])){
// Connect to MySQL.
require ('mysql_connect.php');
// Connect to the Database
// Name for the Database
$d = "bardwangsql";
// Make the query:
$q = "SELECT * FROM $d.visitor ORDER BY state, city;";
$r = mysql_query ($q); // Run the query.
// to get an array of order numbers
$array = array();
// Fetch and print all the records:
while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
$array[$row['city']." , ".$row['state']] = $row['number'];
}
}
else{
printf("<script>location.href='adminaccess.php'</script>");
}
?>
<?php
echo "<div class='welcome'>Welcome Admin</div>";
?>
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></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);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
var rows = new Array();
<?php foreach($array as $key => $val){ ?>
rows.push(['<?php echo $key; ?>', <?php echo $val; ?>]);
<?php } ?>
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Number');
data.addRows(rows);
// Set chart options
var options = {title:'Visitor',
hAxis: {title: 'City State', titleTextStyle: {color: 'red'}},
vAxis: {maxValue: 1},
width:600,
height:300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<meta charset="utf-8">
<link rel="stylesheet" href="Springtea.css">
<script src="files/jquery.min.js"></script>
<script src="files/jquery.validate.min.js"></script>
<script src="files/validation.js"></script>
<script src="files/login.js"></script>
<title>Spring Tea - My Visitor</title>
</head>
<body>
<h1><em>Spring Tea - My Visitor</em></h1>
<div class ="navbar">
<ul>
<li><a href="Springtea.php">Home</a></li>
<li class="confirm"><a href="account.php">Your Account</a>
<ul class="subnavbar">
<li><a href="confirmation.php">Your Orders</a></li>
</ul>
</li>
<li><a href="teainfo.php">Tea Info</a>
<ul class="subnavbar">
<li><a href="regular_tea.php">Regular Tea</a></li>
<li><a href="pu-erh_tea.php">Pu-erh Tea</a></li>
<li><a href="teapot.php">Teapot</a></li>
</ul>
</li>
<li class="order"><a href="cart.php">Cart</a>
</li>
<li><a href="contact_info.php">Contact Info</a></li>
</ul>
</div>
<br><br><br><br><br>
<fieldset>
<h1 class="info">My Visitor</h1>
<div id="chart_div"></div>
<h1 class="info"><a class= 'back' href='admin.php'>Go to Admin</a></h1>
</fieldset>
<hr>
<p class="red"><a href="Credit.html">Credits</a>
</p>
</body>
</html>