diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/datas.php | 4 | ||||
-rw-r--r-- | includes/header.php | 12 | ||||
-rw-r--r-- | includes/maps.php | 34 |
3 files changed, 27 insertions, 23 deletions
diff --git a/includes/datas.php b/includes/datas.php index 5d901ee..c445ca1 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -26,9 +26,9 @@ function topScores($mapid, $top = 5, $bottom = 0) { ORDER BY solutions.moves DESC, solutions.dateModified ASC LIMIT $bottom, $top "; - $result = mysql_query($sql); + $result = mysql_query($sql) or die(mysql_error()); $utime = date("g:i A (T)"); - $output .= "<table class='score'>"; + $output = "<table class='score'>"; $output .= "<tr title='Updated $utime'>"; $output .= "<th>Rank</th>"; $output .= "<th>Badge</th>"; diff --git a/includes/header.php b/includes/header.php index d718588..887aa41 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,6 +1,7 @@ <?php
-
+$accepted = isset($_SESSION['accepted']) && $_SESSION['accepted'] == 1;
function htmlHeader($css = array(), $title = 'Pathery', $desc = '') {
+ global $accepted;
?>
<!DOCTYPE html>
<html xml:lang="en" lang="en">
@@ -25,7 +26,7 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '') { for(e=0;e<g.length;e++)(function(a){b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,0)))}})(g[e]);c._i.push([a,d,f])};window.mixpanel=c})(document,[]);
mixpanel.init("24743c6567f831ddfcbbbd3f397e11e4");
<?php
- if ($_SESSION['accepted'] == 1) {
+ if ($accepted) {
if ($_SESSION['displayName'] != 'noname')
echo 'mixpanel.name_tag(' . json_encode($_SESSION['displayName']) . ');';
if ($_SERVER['HTTP_HOST'] == 'www.pathery.com')
@@ -89,11 +90,10 @@ function htmlFooter() { }
function topbar($links) {
+ global $accepted;
echo '<div id="topbar">';
- $page = $_GET['page'];
- if ($page == '')
- $page = 'home';
+ $page = isset($_GET['page']) ? $_GET['page'] : 'home';
foreach ($links as $key => $value) {
if ($page == $key)
$selected = " selected";
@@ -103,7 +103,7 @@ function topbar($links) { }
echo "<div id='user'>";
- if ($_SESSION['accepted'] == 1) {
+ if ($accepted) {
echo "Logged in as <a href='cp' title='change name'>$_SESSION[displayName]</a><br>";
if ($_SESSION['displayName'] == 'noname')
echo "<a href='cp' title='change name'>Update your name</a> | ";
diff --git a/includes/maps.php b/includes/maps.php index 4618ff8..16aa35c 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -109,7 +109,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) $jsonmap = str_replace("'", "\'", json_encode($mapdata));
//This works in chrome, not sure about others.
- $preloaddiv .= "
+ $preloaddiv = "
<div style='visibility:hidden;display:none'>
<img src='images/Path1.png' alt=''>
<img src='images/Path2.png' alt=''>
@@ -134,16 +134,20 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) <table style='width:$width;height:$height;' class='grid_table'>
$maptable
</table>";
-
-
- $prefSpeed = $_COOKIE['pref_speed'];
- $speedOption['Slow'] = 1;
- $speedOption['Med'] = 2;
- $speedOption['Fast'] = 3;
- $speedOption['Ultra'] = 4;
- if (!in_array($prefSpeed, $speedOption))
+
+
+ if (isset($_COOKIE['pref_speed'])) {
+ $prefSpeed = $_COOKIE['pref_speed'];
+ $speedOption['Slow'] = 1;
+ $speedOption['Med'] = 2;
+ $speedOption['Fast'] = 3;
+ $speedOption['Ultra'] = 4;
+ if (!in_array($prefSpeed, $speedOption))
+ $prefSpeed = '2';
+ } else
$prefSpeed = '2';
+ $rOption = '';
foreach ($speedOption as $key => $value) {
$rOption .= "<option value='$value'";
if ($prefSpeed == $value)
@@ -151,7 +155,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) $rOption .= ">$key</option>\n";
}
- if ($_COOKIE['pref_mute'] == "true") {
+ if (isset($_COOKIE['pref_mute']) && $_COOKIE['pref_mute'] == "true") {
$mutebutton = "<label><input onclick='savePref(\"mute\", this.checked)' type='checkbox' id='$idprefix,mute' checked='checked' />Mute</label>";
} else {
$mutebutton = "<label><input onclick='savePref(\"mute\", this.checked)' type='checkbox' id='$idprefix,mute' />Mute</label>";
@@ -400,27 +404,27 @@ function GenerateShapedMap($shape, $params) { // $checkpoints++;
//Confirm params.
- if ($params['rockchance'])
+ if (isset($params['rockchance']))
$rockchance = $params['rockchance'];
else
$rockchance = 10;
- if ($params['checkpoints'])
+ if (isset($params['checkpoints']))
$checkpoints = $params['checkpoints'];
else
$checkpoints = 0;
- if ($params['teleports'])
+ if (isset($params['teleports']))
$teleports = $params['teleports'];
else
$teleports = 0;
- if ($params['name'])
+ if (isset($params['name']))
$mapName = $params['name'];
else
$mapName = '';
- if (is_int($params['walls']))
+ if (isset($params['walls']) && is_int($params['walls']))
$walls = $params['walls'];
else
$walls = 13;
|