diff --git a/games/bamboofield.html b/games/bamboofield.html index 0b0ee73..deb5ece 100644 --- a/games/bamboofield.html +++ b/games/bamboofield.html @@ -253,6 +253,8 @@ } } + var sent; + var tic = function() { //console.log('tic was called'); @@ -264,16 +266,22 @@ } else { - context.fillStyle = "rgba(0, 0,0 ,1)"; - context.fillRect(0,0, width, height); + if(!sent) + { + context.fillStyle = "rgba(0, 0,0 ,1)"; + context.fillRect(0,0, width, height); - context.fillStyle = "rgba(255, 255,255 ,1)"; - context.font = "20px Georgia"; - context.fillText("You died with a score of: " + score, 250, 325); - + context.fillStyle = "rgba(255, 255,255 ,1)"; + context.font = "20px Georgia"; + context.fillText("You died with a score of: " + score, 250, 325); + + + document.body.innerHTML += '
>
'; + document.getElementById("dynForm").submit(); + + sent = true; + } - document.body.innerHTML += '
>
'; - document.getElementById("dynForm").submit(); } animate(tic); } diff --git a/games/bamboofield.php b/games/bamboofield.php index 9b0be40..90eee50 100644 --- a/games/bamboofield.php +++ b/games/bamboofield.php @@ -5,16 +5,29 @@ //ini_set('display_errors', 1); include '../includes/header.php'; - echo '
-
'; + + echo '
'; + echo '
'; include('bamboofield.html'); - echo '
'; + echo '
'; //include('../includes/profile.php'); + include('highscore.php'); + + + echo '
'; + + echo '
'; + echo '
'; + + //edit user + include('../user/profile.php'); + - echo '
'; - echo '
'; + echo '
'; + include('userscores.php'); + echo '
'; include '../includes/footer.php'; diff --git a/games/highscore.php b/games/highscore.php new file mode 100644 index 0000000..b0f0ded --- /dev/null +++ b/games/highscore.php @@ -0,0 +1,42 @@ +
High Scores
'; + + $q = "select * from scores order by score desc limit 20"; + $r = mysqli_query($dbc, $q); + echo '
'; + echo ' + + + + '; + $rank = 0; + while($row = mysqli_fetch_array($r)) + { + $rank ++; + echo ''; + + echo ''; + + echo ''; + + //score + echo ''; + + echo ''; + } + echo '
RankUser NameScore
' . $rank . ''; + + $q2 = "select user_name from users where user_id='". $row['user_id'] . "' limit 1"; + $r2 = mysqli_query($dbc, $q2); + + while($row2 = mysqli_fetch_array($r2)) + { + echo $row2['user_name']; + } + + echo '' . $row['score'] . '
'; + +?> \ No newline at end of file diff --git a/games/insertScore.php b/games/insertScore.php index 6119155..4edf392 100644 --- a/games/insertScore.php +++ b/games/insertScore.php @@ -1,23 +1,36 @@ $value) +// { +// echo $value . '
'; +// } $q = "insert into scores(game, user_id, score) values('$i_game','$i_user_id','$i_score')"; + if($i_user_id > 0) + { + $r = mysqli_query($dbc, $q); + } + +// +// +// echo '

' . $q . '

'; - echo '

' . $q . '

'; - $r = mysqli_query($dbc, $q); - //echo(""); + if($i_game == 1) + { + header("Location: bamboofield.php"); + } } diff --git a/games/userscores.php b/games/userscores.php new file mode 100644 index 0000000..f9b931b --- /dev/null +++ b/games/userscores.php @@ -0,0 +1,44 @@ +
User\'s Personal Records
'; + + $q = "select * from scores where user_id='" . $_SESSION['user_id'] . "' order by score desc limit 20"; + $r = mysqli_query($dbc, $q); + echo '
'; + echo ' + + + '; + + while($row = mysqli_fetch_array($r)) + { + echo ''; + + + echo ''; + + //score + echo ''; + + echo ''; + } + echo '
User NameScore
'; + + $q2 = "select user_name from users where user_id='". $row['user_id'] . "' limit 1"; + $r2 = mysqli_query($dbc, $q2); + + while($row2 = mysqli_fetch_array($r2)) + { + echo $row2['user_name']; + } + + echo '' . $row['score'] . '
'; + } + + + +?> \ No newline at end of file diff --git a/includes/footer.php b/includes/footer.php index 51121b2..55e6b69 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -2,7 +2,7 @@