diff options
-rw-r--r-- | changelog/changelog.txt | 18 | ||||
-rw-r--r-- | globe.php | 42 | ||||
-rw-r--r-- | includes/db.inc.php | 9 | ||||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | js/mapspecs.js | 22 | ||||
-rw-r--r-- | pages/embed.php | 113 | ||||
-rw-r--r-- | pages/gallery.php | 47 | ||||
-rw-r--r-- | pages/tutorial.php | 116 |
8 files changed, 337 insertions, 34 deletions
diff --git a/changelog/changelog.txt b/changelog/changelog.txt index 4489604..5aca7cf 100644 --- a/changelog/changelog.txt +++ b/changelog/changelog.txt @@ -1,24 +1,6 @@ =================
== NamePending ==
=================
-04-04-11
- Setup the leaderboard to show every solution from yesterday. - Snap
- Modified loadSol() JS function to support other calls. - Snap
- Added col1 and col2 classes for the columns. They're now used on the homepage and leaderboard page. - raylu
- The leaderboard specific CSS is in statsstyle.css. It's currently included on all pages, unfortunately. - raylu
- Cleaned up the leaderboard.php code duplication. - raylu
- Added some Javascript to only show one stats section at a time on the leaderboard page. - raylu
-
-04-03-11
- Fixed a database related issue, solution size was insuffecient. - Snap
- Preferences for mute/speed is now saved - Snap
- Facebook page semi-started (awaiting name?) - Snap
-
-03-28-11 - 03-31-11
- Added maps-per-day. - Snap
- A few map-types designed and added. - Snap
- Added deny all .htaccess to /pages. - Snap
-
03-27-11
Added yesterdays best solution to leaderboard. - Snap
@@ -6,15 +6,12 @@ session_start(); //include_once 'db.inc.php';
-
-
-$mydomain = "http://www.pathery.com/";
+$mydomain = "http://www.mazetd.4xg.net";
//https://www.google.com/accounts/o8/id?id=AItOawl4GX29ka40T4ZeuXnR2FVsP4LZWaED_T8
//https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawl
-
include_once("./includes/header.php");
@@ -63,6 +60,37 @@ function CookieLogin() { }
+//error_reporting(0);
+//$old_error_handler = set_error_handler("userErrorHandler");
+function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) {
+ $time=date("d M Y H:i:s");
+ // Get the error type from the error number
+ $errortype = array (1 => "Error",
+ 2 => "Warning",
+ 4 => "Parsing Error",
+ 8 => "Notice",
+ 16 => "Core Error",
+ 32 => "Core Warning",
+ 64 => "Compile Error",
+ 128 => "Compile Warning",
+ 256 => "User Error",
+ 512 => "User Warning",
+ 1024 => "User Notice");
+ $errlevel=$errortype[$errno];
+
+ //Write error to log file (CSV format)
+ $errfile=fopen("errors.csv","a");
+ fputs($errfile,"\"$time\",\"$filename:
+ $linenum\",\"($errlevel) $errmsg\"\r\n");
+ fclose($errfile);
+
+ //if($errno!=2 && $errno!=8) {
+ //Terminate script if fatal error
+ //die("A fatal error has occurred. Script execution has been aborted");
+ //}
+}
+
+
@@ -122,8 +150,8 @@ Function CheckAuth($page) { }
//!! Contains domain !!
-Function DoRedirect($message = "Thanks", $to = "http://www.pathery.com/", $duration = "3") {
- $to=(is_null($to)?'http://www.pathery.com/':$to);
+Function DoRedirect($message = "Thanks", $to = "http://www.mazetd.4xg.net/", $duration = "3") {
+ $to=(is_null($to)?'http://www.mazetd.4xg.net/':$to);
if ($duration == 0) {
header("Location: $to");
@@ -154,4 +182,6 @@ Function DoRedirect($message = "Thanks", $to = "http://www.pathery.com/", $durat }
+
+
?>
diff --git a/includes/db.inc.php b/includes/db.inc.php index 8e9bdfb..9287ed2 100644 --- a/includes/db.inc.php +++ b/includes/db.inc.php @@ -1,10 +1,11 @@ <?php
+
global $mysqlid;
-$db_host = "db2838.perfora.net";
-$db_user = "dbo358894438";
-$db_name = "db358894438";
-$db_pass = "MAZE4US";
+$db_host = "db2894.perfora.net";
+$db_user = "dbo362854667";
+$db_name = "db362854667";
+$db_pass = "mazes4me";
$mysqlid = @mysql_connect($db_host,$db_user, $db_pass) or die("Cannot connect to database.");
@mysql_select_db($db_name, $mysqlid) or die("Invalid database.");
@@ -29,6 +29,10 @@ switch (strtolower($_GET[page])) { require("pages/test.php");
break;
+ case "tutorial":
+ require("pages/tutorial.php");
+ break;
+
case "embed":
require("pages/embed.php");
break;
diff --git a/js/mapspecs.js b/js/mapspecs.js index fe58658..17e4a74 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -8,6 +8,9 @@ window.onload = function(){ //document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks+"</b>";
//doSend();
loadSol();
+ if (ischallenge == true) {
+ challengehint();
+ }
}
var solution = new Array();
@@ -274,6 +277,9 @@ function animatePathDone(mapid) { updateDsp(mapid, 'dspScore', htmlscores);
htmlscores = '';
}
+ if (ischallenge == true) {
+ challengecomplete(mapid);
+ }
}
function request_scores_done() {
@@ -624,12 +630,16 @@ function doanimate(x, y, p, c, mapid) { setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"')",rs);
}
-function flashelement(eid, times, color) {
+function flashelement(eid, times, color, speed) {
//alert("exe"+eid);
if (document.getElementById(eid) == undefined) return;
if (!color) {
color = "#FFFF44";
}
+ if (!speed) {
+ speed = 220;
+ }
+ speedon = speed * .5;
//document.getElementById(eid).setAttribute('class', 'no_transition');
var currentclass = document.getElementById(eid).className;
if (document.getElementById(eid).classOrigName != undefined)
@@ -639,17 +649,17 @@ function flashelement(eid, times, color) { document.getElementById(eid).style.backgroundColor = '#000000';
for (var i=0; i<times; i++) {
//Flash bright
- setTimeout("document.getElementById('"+eid+"').style.color = '#000000'", i*220);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+color+"'", i*220);
+ setTimeout("document.getElementById('"+eid+"').style.color = '#000000'", i*speed);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+color+"'", i*speed);
// setTimeout("document.getElementById('"+mapid+",dspCount').style.fontWeight = 'bold'", i*200);
//Flash out
- setTimeout("document.getElementById('"+eid+"').style.color = ''", (i*220) + 100);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = ''", (i*220) + 100);
+ setTimeout("document.getElementById('"+eid+"').style.color = ''", (i*speed) + speedon);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = ''", (i*speed) + speedon);
// setTimeout("document.getElementById('"+mapid+",dspCount').style.fontWeight = ''", i*200);
}
//setTimeout("document.getElementById('"+eid+"').className = '"+currentclass+"'", (i*220) + 200);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+currentColor+"'", (i*220) + 200);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+currentColor+"'", (i*speed) + 200);
//document.getElementById(eid).className=currentclass;
//document.getElementById(eid).style.backgroundColor=currentColor;
}
diff --git a/pages/embed.php b/pages/embed.php new file mode 100644 index 0000000..4c1ca68 --- /dev/null +++ b/pages/embed.php @@ -0,0 +1,113 @@ +<?PHP
+htmlHeader();
+?>
+
+<body>
+<script type="text/javascript" src="sounds/script/soundmanager.js"></script>
+
+<?php
+include('./includes/maps.php');
+include('./includes/mapoftheday.php');
+
+include('./includes/datas.php');
+
+
+
+//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;
+}
+
+$normal = 'Normal';
+$easy = 'Simple';
+$hard = 'Complex';
+
+$today = date('l');
+//if ($today == 'Sunday' OR $today == 'Saturday')
+ //$today = 'Weekend Map';
+//else
+ $today .= "'s";
+$special = "$today $mapstyle";
+
+switch ($_GET['maptype']) {
+ case "normal":
+ case "2":
+ $maptype = 2;
+ $normal = '<b>Normal</b>';
+ break;
+
+ case "hard":
+ case "3":
+ $maptype = 3;
+ $hard = '<b>Complex</b>';
+ break;
+
+ case "day":
+ case "4":
+ $maptype = 4;
+ $special = "<b>$special</b>";
+ break;
+
+ case "easy":
+ case "1":
+ default:
+ $maptype = 1;
+ $easy = '<b>Simple</b>';
+}
+
+$motd = MapOfTheDay($maptype);
+$mapID = $motd['id'];
+$map = $motd['map'];
+$userID = $_SESSION['userID'];
+$date = date("m-d-y");
+//$mergesolution = mergeMapSolution($map, $mysolution);
+$topscores = topScores($motd['id'], 30);
+$topscorediv = "<div id='$mapID,dspScore'>\n$topscores\n</div>";
+$mergesolution = $map;
+
+?>
+<div class="col2" style="text-align: center">
+<?
+echo "$date: <a href='?page=embed&maptype=easy'>Easy</a> | ";
+echo "<a href='?page=embed&maptype=normal'>Normal</a> | ";
+echo "<a href='?page=embed&maptype=hard'>Hard</a> | ";
+echo "<a href='?page=embed&maptype=day'>Special</a>";
+
+echo DisplayMap($mergesolution, $mapID);
+
+$mysolution = getSolution($userID, $mapID);
+$solutiondiv .= "<div id='mapsol' style='visibility:hidden;display:none'>";
+//$solutiondiv .= "<div id='mapsol'>";
+$solutiondiv .= $mapID.":".$mysolution;
+$solutiondiv .= '</div>';
+
+echo $solutiondiv;
+?>
+<a href="http://www.pathery.com">www.pathery.com</a>
+</div>
+<script type="text/javascript">soundManagerInit();</script>
+
+</body>
+</html>
diff --git a/pages/gallery.php b/pages/gallery.php index 68c17ae..259ac2a 100644 --- a/pages/gallery.php +++ b/pages/gallery.php @@ -79,7 +79,54 @@ $map = GenerateMap( weight(3,3,3,4) //Teleports ); +//ABC's +$map = GenerateMap( + 19, 11, 12 , //width, height, rocks + weight(20,21,22,22,23) , //Walls + weight(3) , //Checkpoints + weight(0) //Teleports +); + +//Ultra Complex +$map = GenerateMap( + 18, 16, 12 , //width, height, rocks + weight(16,17,18,18) , //Walls + weight(5) , //Checkpoints + weight(5) //Teleports +); +//Tall tall map +$map = GenerateMap( + 18, 14, 20 , //width, height, rocks + weight(30) , //Walls + weight(1) , //Checkpoints + weight(1) //Teleports +); +//Thirty +$map = GenerateMap( + 18, 14, 20 , //width, height, rocks + weight(30) , //Walls + weight(1) , //Checkpoints + weight(1) //Teleports +); +//Simple +$map = GenerateMap( + 18, 9, 7 , //width, height, rocks + weight(15,16,17) , //Walls + weight(0) , //Checkpoints + weight(0) //Teleports +); +//huge +$map = GenerateMap( + 75, 20, 7 , //width, height, rocks + weight(100) , //Walls + weight(5) , //Checkpoints + weight(4) //Teleports +); +$a[0] = 't'; +$a[1] = 't'; +$a['1'] = 'hi'; +echo $a[1]; $mapdisplay = DisplayMap($map); $code = GenerateMapCode($map); diff --git a/pages/tutorial.php b/pages/tutorial.php new file mode 100644 index 0000000..3ce0d06 --- /dev/null +++ b/pages/tutorial.php @@ -0,0 +1,116 @@ +<?PHP
+htmlHeader();
+?>
+<body>
+<?php
+topbar($Links);
+?>
+
+<script type="text/javascript" src="sounds/script/soundmanager.js"></script>
+
+<?
+$requiredmoves = '18';
+?>
+
+<script type="text/javascript">
+ischallenge = true;
+
+function challengecomplete(mapid) {
+ var moves = mapjson[mapid].moves;
+
+ if (moves == <? echo $requiredmoves; ?>) {
+ flashelement('nextbtn', 15, null, 400);
+ updateDsp(1, 'instructions', 'Great Job!<br />Lets move on to the next shall we?')
+ } else {
+ //challengehint();
+ updateDsp(1, 'instructions', 'Place some walls<br />What would make it travel the longest?')
+ flashelement('1,instructions', 2, '#cce', 700);
+ setTimeout("flashelement('1,3,5', 10, '#cce', 760);", 1500);
+ setTimeout("flashelement('1,4,6', 10, '#cce', 760);", 1500);
+ }
+}
+
+function challengehint() {
+ //setTimeout("flashelement('1,3,5', 10, '#cce', 620);", 100);
+ //setTimeout("flashelement('1,4,6', 10, '#cce', 620);", 100);
+ setTimeout("flashelement('1,btn', 6, '#ee4', 620);", 1500);
+ setTimeout("flashelement('1,instructions', 3, '#cce', 620);", 700);
+ //updateDsp(mapid, element, data) {
+}
+
+
+</script>
+
+<?php
+include('./includes/maps.php');
+
+include('./includes/datas.php');
+
+
+?>
+<div class="col2" style="text-align: center">
+<br /> <br />
+<strong><p id='1,instructions'>
+Press GO!
+<br />
+</p>
+</strong>
+<br />
+<?
+echo "<a href='#'>Previous</a> | <a href='#' id='nextbtn'>Next</a> ";
+
+$challenge1[] = "sooraooof";
+$challenge1[] = "sooorooof";
+$challenge1[] = "sooooooof";
+$challenge1[] = "sooooooof";
+$challenge1[] = "sooooooof";
+
+$myparams['checkpoints'] = 1;
+$myparams['teleports'] = 0;
+$myparams['walls'] = 2;
+
+$map1 = GenerateShapedMap($challenge1, $myparams);
+
+$challenge2[] = "soooraoof";
+$challenge2[] = "sooooroof";
+$challenge2[] = "sooooooof";
+$challenge2[] = "sooroooof";
+$challenge2[] = "soobrooof";
+
+$myparams['checkpoints'] = 2;
+$myparams['teleports'] = 0;
+$myparams['walls'] = 4;
+
+$map2 = GenerateShapedMap($challenge2, $myparams);
+
+$challenge3[] = "soooraoof";
+$challenge3[] = "sooooroof";
+$challenge3[] = "sooooooof";
+$challenge3[] = "sooroooof";
+$challenge3[] = "soobrooof";
+
+$myparams['checkpoints'] = 1;
+$myparams['teleports'] = 0;
+$myparams['walls'] = 4;
+
+$map3 = GenerateShapedMap($challenge3, $myparams);
+
+echo DisplayMap($map1, 1);
+echo "<br />";
+echo "<br /><center>map2</center>";
+echo "<br />";
+//echo DisplayMap($map2, 2);
+
+//$mysolution = getSolution($userID, $mapID);
+//$solutiondiv .= "<div id='mapsol' style='visibility:hidden;display:none'>";
+//$solutiondiv .= "<div id='mapsol'>";
+//$solutiondiv .= $mapID.":".$mysolution;
+//$solutiondiv .= '</div>';
+
+//echo $solutiondiv;
+?>
+</div>
+<script type="text/javascript">soundManagerInit();</script>
+
+</body>
+</html>
|