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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
<?php
htmlHeader(array('stats'), 'Pathery', 'Compete to create the longest maze possible. 4 New maps every day at 9 PM Pacific');
include_once ('./includes/maps.php');
include_once ('./includes/mapoftheday.php');
include_once ('./includes/db.inc.php');
include_once ('./includes/datas.php');
//Get custom wall colors;
$wallColor = '';
$wallEmblem = '';
$noteScript = '';
if ($accepted) {
$userID = $_SESSION['userID'];
$sql = "
SELECT
userData.wallColor,
userData.wallEmblem
FROM `userData`
WHERE userID = '$userID' ";
$result = mysql_query($sql);
if ($result)
list($wallColor, $wallEmblem) = mysql_fetch_row($result);
//$note = getNotified($userID);
$note = false;
if ($note !== false) {
//$note = str_replace("'", "\'", $note);
//Double your slashes double your fun (Required)
$note = addslashes($note);
$note = addslashes($note);
$noteScript = "
<script type='text/javascript'>
setTimeout(\"showNotification('".$note."');\", 1000);
if (getCookie('pref_mute') != 'true') {
setTimeout(\"soundManager.setVolume('achieve', 40);\", 1340);
setTimeout(\"soundManager.play('achieve');\", 1350);
}
</script>
";
}
}
function tutorialComplete($userID) {
$sql = "SELECT * FROM `achievements`
WHERE `type` = 32 AND `userID` = '$userID'";
$result = mysql_query($sql);
if (mysql_num_rows($result) >= 1)
return true;
else
return false;
}
//Get the current day as int.
$numday = date('w');
$numday = intval($numday);
switch ($numday) {
case 0:
$mapstyle = 'Thirty';
break;
case 1:
$mapstyle = 'Simple';
break;
case 2:
$mapstyle = "ABC's";
break;
case 3:
$mapstyle = 'Teleport Madness';
break;
case 4:
$mapstyle = 'Rocky Maze';
break;
case 5: //Friday
$mapstyle = 'Side to Side';
break;
case 6: //Saturday
$mapstyle = "Seeing Double";
break;
}
?>
<body>
<script type="text/javascript">
playerWallColor = '<?PHP echo isset($wallColor) ? $wallColor : ''; ?>';
playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>';
</script>
<?php
topbar($Links);
?>
<div class="wrapper">
<?
if ($accepted) {
if (tutorialComplete($userID) == false) {
echo "<center><a href='tutorial'>Complete the tutorial</a> to unlock a blue wall color:";
echo "<table><tr><td style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table></center><br />";
}
}
$motd = MapOfTheDay(1);
$jmid[1] = $motd['id'];
$mapContent = displayMaze($motd, 1);
$motd = MapOfTheDay(2);
$jmid[2] = $motd['id'];
$mapContent .= displayMaze($motd, 2);
$motd = MapOfTheDay(3);
$jmid[3] = $motd['id'];
$mapContent .= displayMaze($motd, 3);
$motd = MapOfTheDay(4);
$jmid[4] = $motd['id'];
$mapContent .= displayMaze($motd, 4);
$special = $motd['map'][0][6];
if ($special == '') {
$special = 'Special';
}
?>
<div id="difficulties">
<a href="javascript:showStats(1)" id="dl-1">Simple</a>
<a href="javascript:showStats(2)" id="dl-2">Normal</a>
<a href="javascript:showStats(3)" id="dl-3">Complex</a>
<a href="javascript:showStats(4)" id="dl-4"><? echo $special; ?></a>
</div>
<div style="clear: both"></div>
<noscript>Sorry, this game requires scripts to run. Please enable javascript and <a href='home'>Reload this site</a>
<br />This game is best viewed in <a href='http://www.google.com/chrome'>Google Chrome</a>
</noscript>
<? echo $mapContent; ?>
<?
function displayMaze($motd, $mapType) {
global $accepted, $userID;
//Gather data for map;
$mapID = $motd['id'];
$map = $motd['map'];
$width = $map[0][0];
//data for the topscores
$topscores = topScores($motd['id'], 30);
$topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
$mysolution = '';
$mymoves = '';
if ($accepted) {
$sol = getSolution($userID, $mapID);
$mysolution = $sol['solution'];
//!! implement mymoves
$mymoves = $sol['moves'];
}
if (isset($_SESSION[$mapID.'sol']) && $mysolution == '') {
$mysolution = $_SESSION[$mapID.'sol'];
$mymoves = $_SESSION[$mapID.'moves'];
}
$r = "<div id=\"yms-$mapType\" class='hidden-maps'>";
$r .= " <div class='wrapper'>";
// if ($width <= 16) {
// $r .= ' <div class="col1">';
// $r .= $topscorediv;
// $r .= ' </div>';
// $r .= ' <div class="col2">';
// $r .= "<a href='javascript:requestSol(\"$mapID\");'>Load your best solution</a><br />";
// $r .= DisplayMap($map, $mapID);
// $r .= ' </div>';
$r .= " <div style='text-align: center;'>";
$r .= " <div style='display:inline-block;margin: 0 auto;text-align: left;'>";
$r .= " <a href='javascript:requestSol(\"$mapID\");'><strong>Load your best solution</strong></a><br />";
$r .= DisplayMap($map, $mapID);
$r .= " </div></div>";
$r .= " <div style='padding-top: 20px;'>";
$r .= $topscorediv;
$r .= ' </div>';
$r .= ' </div>';
$r .= '</div>';
$mapSolDiv = "<script>
loadSol(\"$mapID:$mysolution\", \"$mymoves\");
</script>";
$r .= $mapSolDiv;
//Clear our floatingness
$r .= '<div style="clear: both"></div>';
return $r;
}
$timerem = strtotime("tomorrow") - strtotime("now");
?>
<div style='text-align: center; margin-top: 5px;'>
New maps in: <span id="countdown">00:00:00</span>
</div>
<script type="text/javascript">
var countdownInt = self.setInterval(countdown, 1000);
var tomorrow = new Date();
//We're counting down to "tomorrow"
tomorrow.setTime(tomorrow.getTime() + <? echo $timerem; ?> * 1000);
var userConfirm = true;
function countdown() {
var now = new Date();
now.setTime(now.getTime());
//Find the difference in seconds between now and tomorrow.
var timerem = tomorrow.getTime() - now.getTime();
timerem = timerem / 1000;
var totalSeconds = timerem;
if (timerem < 1)
window.clearInterval(countdownInt);
var hours = addZero(timerem/3600);
timerem = timerem%3600;
var minutes = addZero(timerem/60);
timerem = timerem%60;
var seconds = addZero(timerem);
var stamp = hours + ":" + minutes + ":" + seconds;
document.getElementById("countdown").innerHTML = stamp;
if (totalSeconds <= 1 && userConfirm == true) {
userConfirm = confirm("It's Tomorrow Today! Go to new maps?")
if (userConfirm) {
location.reload(true);
}
}
}
function addZero(num) {
num = Math.floor(num);
var numStr = num + '';
if (numStr.length < 2)
numStr = "0" + numStr;
return numStr;
}
</script>
</div>
<div id="copy" style='width:100%;clear: both'>
Copyright © 2011-2012 pathery.com
</div>
<script>
function showStats(type) {
for (var i = 1; i <= 4; i++) {
var elem = document.getElementById("yms-" + i);
elem.className = elem.className.replace('shown-maps', 'hidden-maps');
elem = document.getElementById("dl-" + i);
elem.className = elem.className.replace('selected', '');
}
var elem = document.getElementById("yms-" + type);
elem.className = elem.className.replace('hidden-maps', 'shown-maps');
elem = document.getElementById("dl-" + type);
if (elem.className.indexOf('selected') < 0)
elem.className += 'selected';
var jmid=new Array();
<?
echo "
jmid[0] = '1';
jmid[1] = '$jmid[1]';
jmid[2] = '$jmid[2]';
jmid[3] = '$jmid[3]';
jmid[4] = '$jmid[4]';
";
?>
updateScoresReq(jmid[type], type);
}
showStats(1);
</script>
<script src="sounds/script/soundmanager.js"></script>
<script type="text/javascript">soundManagerInit();</script>
<?PHP echo $noteScript; ?>
<?php
htmlFooter();
?>
|