diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2012-02-02 23:01:37 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2012-02-02 23:01:37 -0800 |
commit | 418f53fa5ac1601175fa6a937690a0c70efae446 (patch) | |
tree | c475fc5276d8d9596c38242d24e39a09728a56d5 /pages/home.php | |
parent | de7cb061628b47f462e90aa57309350dd9f7e7a0 (diff) | |
download | pathery-418f53fa5ac1601175fa6a937690a0c70efae446.tar.xz |
Game loading custom emblems & session loading.
Add: Loading of wallColor and wallEmblem for the game.
Add: Support for loading of SESSION stored solutions for non-logged in users.
Diffstat (limited to 'pages/home.php')
-rw-r--r-- | pages/home.php | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/pages/home.php b/pages/home.php index e347d54..66c5182 100644 --- a/pages/home.php +++ b/pages/home.php @@ -1,7 +1,54 @@ <?PHP
htmlHeader(array('stats'));
+
+
+//Get custom wall colors;
+
+
+$wallColor = '';
+$wallEmblem = '';
+
+if ($_SESSION[accepted] == 1) {
+ $userID = $_SESSION['userID'];
+ include_once('./includes/db.inc.php');
+
+ $sql = "
+ SELECT
+ userData.wallColor,
+ userData.wallEmblem
+ FROM `userData`
+ WHERE userID = '$userID' ";
+ $result = mysql_query($sql);
+ if ($result)
+ list($wallColor, $wallEmblem) = mysql_fetch_row($result);
+}
+
+//$wallColor = '#ff3344';
+//$wallEmblem = 'StarsR_W.png';
+//$wallEmblem = 'DiagonalCover_B.png';
+//$wallEmblem = 'DiagonalCover_W.png';
+//$wallEmblem = 'X_B.png';
+
+
+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;
+}
+
?>
+<script type="text/javascript">
+
+playerWallColor = '<?PHP echo $wallColor; ?>';
+playerWallEmblem = '<?PHP echo $wallEmblem; ?>';
+//playerEmblem = 'Shine.gif';
+</script>
+
<body>
<?php
include('./includes/maps.php');
@@ -84,6 +131,13 @@ $mergesolution = $map; <div class="wrapper">
<?
+ if ($_SESSION['accepted'] == 1) {
+ 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 />";
+ }
+ }
+
echo "<div id='difficulties'>";
echo "$easy";
echo "$normal";
@@ -93,7 +147,11 @@ $mergesolution = $map; echo DisplayMap($mergesolution, $mapID);
- $mysolution = getSolution($userID, $mapID);
+ if ($_SESSION['accepted'] == 1)
+ $mysolution = getSolution($userID, $mapID);
+ if (isset($_SESSION[$mapID.'sol']) AND $mysolution == '')
+ $mysolution = $_SESSION[$mapID.'sol'];
+
$solutiondiv .= "<div id='mapsol' style='visibility:hidden;display:none'>";
$solutiondiv .= $mapID.":".$mysolution;
$solutiondiv .= '</div>';
@@ -106,11 +164,10 @@ $mergesolution = $map; if ($_SESSION['accepted'] != 1) {
echo "
<div style='text-align: center; margin-top: 20px'>
- <a href='login'>Sign in</a> to have your best solution saved.
+ <a href='login'>Sign in</a> to have your score saved.
</div>
";
}
-
?>
<div id="fb">
@@ -156,4 +213,4 @@ $timerem = strtotime("tomorrow") - strtotime("now"); <?php
htmlFooter();
-?>
+?>
\ No newline at end of file |