-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·176 lines (144 loc) · 3.64 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
$dbhost = 'localhost';
$dbuser = 'cakephp';
$dbpass = 'nj2kjn8s9d';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'layercakedb';
mysql_select_db($dbname);
$result = mysql_query("SELECT * FROM cakes ORDER BY published DESC;");
$npask = array();
$rows = array();
while ($row = mysql_fetch_array($result)){
$rows[] = $row;
$npask[] = $row['id'];
}
//$numonline = explode(" ",exec("python numplayers.py " . join(" ",$npask)));
$rowcount = count($rows);
for ($i=0; $i<$rowcount; $i++){
$rows[$i]['online'] = 0;//$numonline[$i];
}
mysql_close($conn);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Layer Cake</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<style type="text/css">
body{
font-family: sans-serif;
}
.latestlist{
margin-left: 40px;
margin-right: 40px;;
margin-top: 60px;
border-radius: 10px;
-moz-border-radius: 10px;
background-color: #CCCCCC;
padding: 10px;
}
.cakeentry{
border: solid #555555 3px;
border-radius: 5px;
-moz-border-radius: 5px;
background-color: #779cb7;
padding: 10px;
margin: 25px;
margin-top: 12px;
margin-bottom: 12px;
min-height: 100px;
}
.logo{
float:left;
border: none;
}
.create{
float: right;
border-radius: 8px;
-moz-border-radius: 8px;
background-color: #555555;
padding-left: 26px;
padding-right: 26px;
padding-top: 4px;
padding-bottom: 4px;
margin-right: 40px;
}
.createlink{
color: #FFFFFF;
}
.thumb{
float:left;
border: none;
margin-right: 50px;
}
.entrytitle{
float:left;
}
.people{
float: right;
position: relative;
right: 180px;
width: 150px;
top: 60px;
}
</style>
<script type="text/javascript">
function heartToggle(){
}
</script>
<script type="text/javascript">//<![CDATA[
// Google Analytics for WordPress by Yoast v4.06 | http://yoast.com/wordpress/google-analytics/
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-11122994-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// End of Google Analytics for WordPress by Yoast v4.0
//]]></script>
</head>
<body>
<div>
<a href="http://uncc.ath.cx/LayerCake/"><img class="logo" src="header.png" alt="Layer Cake (beta)"/></a>
</div>
<a href="create.html" class="createlink">
<div class="create">
<h3>Create Your Own</h3>
</div>
</a>
<div> </div>
<div class="latestlist">
<h2 class="new">Newest Submissions</h2>
<?
foreach ($rows as $row){
$id = $row['id'];
$title = $row['title'];
$numLayers = $row['numLayers'];
$width = $row['width'];
$height = $row['height'];
$author = $row['author'];
$published = $row['published'];
$hearts = $row['hearts'];
$online = $row['online'];
?>
<div class="cakeentry">
<a href="view.php?id=<? echo $id; ?>">
<img src="images/<? echo $id; ?>/thumb.png" class="thumb"/>
</a>
<div class="entrytitle">
<h3><? echo $title ?></h3>
<h4><? echo $author; ?></h4>
</div>
<div class="people">
People online: <? echo $online; ?>
Active rooms: <? echo ((int)($online / $numLayers)+1); ?>
</div>
</div>
<? } ?>
</div>
</body>
</html>