-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplanets.php
63 lines (55 loc) · 1.82 KB
/
planets.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
<?php
include_once "config.php";
//setup DB con
$db = new PDO('mysql:host=localhost;dbname='.$dbname, $dbuser, $dbpass);
//grab round # from get param or default to latest round
if(isset($_GET['round']) && is_numeric($_GET['round'])) {
$round = $_GET['round'];
$showLatest = 'false';
}
else {
$round = $db->query("SELECT round FROM planet_stats order by round desc limit 1")->fetch()['round'];
$showLatest = 'true';
}
//check for logs of previous/next round
$q = $db->prepare("SELECT * FROM planet_stats WHERE round=?");
$q->execute(array($round-1));
$numPrev = $q->rowCount();
$q = $db->prepare("SELECT * FROM planet_stats WHERE round=?");
$q->execute(array($round+1));
$numNext = $q->rowCount();
?>
<html>
<!-- Coded by Yair Silbermintz - yair[at]silbermintz.com -->
<head>
<title>Schevemarse Planet Supremacy Graph</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<canvas id="myCanvas" width="950" height="630"></canvas>
<div id="left">
<p>
<label>
<input type="checkbox" />
<strong> <span></span></strong>
</label>
</p>
</div>
<div class="clear"></div>
<div id="bottom">
<?php if($numPrev) { ?>
<a id="prev" href="planets.php?round=<?php echo $round-1; ?>"><</a>
<?php } ?>
<span id="round">Round #</span>
<?php if($numNext) { ?>
<a href="planets.php?round=<?php echo $round+1; ?>">></a>
<a href="planets.php">>></a>
<?php } ?>
</div>
<script>var round = <?php echo $round; ?>; var showLatest = <?php echo $showLatest; ?></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script src="js/planets.js" type="text/javascript"></script>
</body>
</html>