diff --git a/about.php b/about.php index fa8b073..08b579c 100644 --- a/about.php +++ b/about.php @@ -1,21 +1,15 @@
-
'; - //add stuff +echo '
+
'; +echo '
'; +include 'user/profile.php'; - echo '
'; - include 'user/profile.php'; +echo '
'; - echo '
'; - echo '
'; - - - include 'includes/footer.php'; - -?> \ No newline at end of file +include 'includes/footer.php'; \ No newline at end of file diff --git a/admin.php b/admin.php index 9787a13..32dd4a4 100644 --- a/admin.php +++ b/admin.php @@ -1,39 +1,31 @@ '; - echo '
'; - - //users - - include('user/users.php'); - - echo '
'; - //profile - include('user/profile.php'); - echo '
'; - - echo '
'; - echo '
'; - - //edit user - include('user/editUser.php'); - - - echo '
'; - //new user - include('user/newUser.php'); - echo '
'; - } - else - { - include('includes/profile.php'); - } - - - require('includes/footer.php'); -?> \ No newline at end of file +//11-24-16 + +require('includes/header.php'); + +if($admin) +{ + echo '
'; + echo '
'; + + include('user/users.php'); + + echo '
'; + + include('user/profile.php'); + echo '
'; + + echo '
'; + echo '
'; + include('user/editUser.php'); + + + echo '
'; + include('user/newUser.php'); + echo '
'; +} +else +{ + include('includes/profile.php'); +} +require('includes/footer.php'); \ No newline at end of file diff --git a/games.php b/games.php index 6a823a3..a6b0c26 100644 --- a/games.php +++ b/games.php @@ -1,22 +1,18 @@
-
'; - include('games/bamboofield.html'); +echo '
+
'; +include('games/bamboofield.html'); - echo '
'; - include('games/zombiePanda.html'); +echo '
'; +include('games/zombiePanda.html'); - echo '
'; - echo '
'; +echo '
'; - - include 'includes/footer.php'; - -?> \ No newline at end of file +include 'includes/footer.php'; \ No newline at end of file diff --git a/games/astroids.html b/games/astroids.html index e0c3017..5f299f7 100644 --- a/games/astroids.html +++ b/games/astroids.html @@ -23,16 +23,16 @@ c.fillRect(0,0, canvas.width, canvas.height); }; - //entire game function playBF() { - var animate = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) + var animate = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60) }; - - + var canvas = document.getElementById("canvas"); var width = 800; @@ -121,54 +121,41 @@ this.dirSpeed = 10; - - + this.render = function() { context.fillStyle = "rgba(255, 255, 255, 1)"; //white context.fillRect(this.x, this.y, this.width, this.height); - - } this.move = function() { - - - for (var key in keysDown) { var value = Number(key); if(value == 37) //left { - this.dir += this.dirSpeed * Math.PI / 360; } else if(value == 39) { - // this.dir -= this.dirSpeed * Math.PI / 360; } else if(value == 38) // up { this.x += this.speed * Math.sin(this.dir); - this.y += this.speed * Math.cos(this.dir); } else if(value == 40) //down { this.x -= this.speed * Math.sin(this.dir); - this.y -= this.speed * Math.cos(this.dir); } else if(value == 32) //shoot { this.shoot(); - } - - } //collisions @@ -178,12 +165,15 @@ { bb = astroids[i]; //if(Math.abs(bb.x - p.x) <= bb.width) - if(p.x > bb.x && p.x < bb.x + bb.width || p.x + p.width < bb.x + bb.width && p.x + p.width > bb.x) + if(p.x > bb.x && p.x < bb.x + bb.width || + p.x + p.width < bb.x + bb.width && p.x + p.width + > bb.x) { - if(p.y > bb.y && p.y < bb.y + bb.height || p.y + p.height < bb.y + bb.height && p.y + p.height > bb.y) + if(p.y > bb.y && p.y < bb.y + bb.height || + p.y + p.height < bb.y + bb.height && + p.y + p.height > bb.y) { alive = false; - bb = -1; } } @@ -191,25 +181,14 @@ } if(this.x < 0) - { this.x += this.speed; - } else if(this.x > width- this.width) - { this.x -= this.speed; - } - + if(this.y < 0) - { this.y += this.speed; - - } else if(this.y > height) - { this.y -= this.speed; - - } - } this.shoot = function() @@ -224,21 +203,13 @@ bullets[i] = new Bullet(this.dir, this.x, this.y); } } - if(dimmed == false) - { bullets.push(new Bullet(this.dir, this.x, this.y)); - } - } } //player object var p = new Player(350, 850); - - - - //object that falls from the sky var Astroid = function(size) { @@ -267,18 +238,15 @@ { this.y = height; this.x = temp; - } else { this.y = temp; this.x = 0; - } this.speed = 2; - - + this.render = function() { context.fillStyle = "rgba(255, 255, 255 , 1)"; //green @@ -299,61 +267,38 @@ //remove bamboo from array score++; return true; - } - } - } var astroids = []; //draws all the objects var render = function() { - 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("Score: " + score, 10, 25); - - + p.render(); for(i= 0; i < astroids.length; i++) - { - if(astroids[i] != -1) - { astroids[i].render(); - } - - } for (var i = bullets.length; i--; ) - { if(bullets[i] != -1) - { bullets[i].render(); - } - } - //console.log('render was called'); - - //context.fillStyle = "rgba(0, 128, 0 ,1)"; //green - //context.fillRect(0, 0, 700, 700); - - //console.log(context); } var update = function() { - addAstroid(); p.move(); - - + var halp = bullets.lenght - + //console.log(halp); //for (b = 0; b < bullets.lenght; b++) //var b; @@ -371,22 +316,11 @@ } } - - + for (i = 0; i< astroids.length; i++) - { if(astroids[i] != -1) - { if(astroids[i].move()) - { astroids[i] = -1; - } - } - } - - - - } var count = 0; @@ -415,8 +349,6 @@ astroids.push(new Astroid()); } - - if(limit > 10) { limit --; @@ -443,15 +375,9 @@ 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; + context.fillText("You died with a score of: " + + score, 250, 325); } - } animate(tic); } @@ -472,9 +398,9 @@ }); //tic(); animate(tic); - }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/games/bamboofield.html b/games/bamboofield.html index 787853e..4b19252 100644 --- a/games/bamboofield.html +++ b/games/bamboofield.html @@ -1,319 +1,276 @@
-
\ No newline at end of file +
\ No newline at end of file diff --git a/games/bamboofield.php b/games/bamboofield.php index 439b6a7..acece88 100644 --- a/games/bamboofield.php +++ b/games/bamboofield.php @@ -1,38 +1,35 @@ '; - echo '
'; - include('bamboofield.html'); +//ini_set('display_errors', 1); +include '../includes/header.php'; +echo '
'; +echo '
'; +include('bamboofield.html'); - echo '
'; - //include('../includes/profile.php'); - include('highscore.php'); - - - echo '
'; - echo '
'; - echo '
'; +echo '
'; +//include('../includes/profile.php'); +include('highscore.php'); - //edit user - include('../user/profile.php'); +echo '
'; - echo '
'; - include('userscores.php'); - echo '
'; +echo '
'; +echo '
'; +//edit user +include('../user/profile.php'); - include '../includes/footer.php'; - -?> \ No newline at end of file + +echo '
'; +include('userscores.php'); +echo '
'; + + +include '../includes/footer.php'; \ No newline at end of file diff --git a/games/highscore.php b/games/highscore.php index 8c577a3..b2168aa 100644 --- a/games/highscore.php +++ b/games/highscore.php @@ -1,44 +1,41 @@
High Scores
'; - - $q = "select * from scores where game = '$game_id' 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 + +//5-17-17 + +echo '

High Scores

'; + +$q = "select * from scores where game = '$game_id' 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'] . '
'; diff --git a/games/insertScore.php b/games/insertScore.php index 66d6146..f0374b0 100644 --- a/games/insertScore.php +++ b/games/insertScore.php @@ -1,42 +1,26 @@ $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 . '

'; - - - - - if($i_game == 1) - { - header("Location: bamboofield.php"); - } - - else if($i_game == 2) - { - header("Location: zombiePanda.php"); - } - - } +//5-16-17 -?> \ No newline at end of file +include_once '../../club_connect.php'; + +if(isset($_POST['game_new_score'])) +{ + $i_game = mysqli_real_escape_string($dbc, + trim($_POST['game'])); + $i_user_id = mysqli_real_escape_string($dbc, + trim($_POST['user_id_score'])); + $i_score = mysqli_real_escape_string($dbc, + trim($_POST['score_validate'])); + $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); + + if($i_game == 1) + header("Location: bamboofield.php"); + + else if($i_game == 2) + header("Location: zombiePanda.php"); +} \ No newline at end of file diff --git a/games/userscores.php b/games/userscores.php index 4491bc6..53b8f93 100644 --- a/games/userscores.php +++ b/games/userscores.php @@ -1,44 +1,37 @@
User\'s Personal Records
'; - - $q = "select * from scores where user_id='" . $_SESSION['user_id'] . "' and game='$game_id' order by score desc limit 20"; - $r = mysqli_query($dbc, $q); - echo '
'; - echo ' - - - '; +//5-17-17 - while($row = mysqli_fetch_array($r)) - { - echo ''; +if($loggedIn) +{ + echo '

User\'s Personal Records +

'; + $q = "select * from scores where user_id='" . $_SESSION['user_id'] + . "' and game='$game_id' order by score desc limit 20"; + $r = mysqli_query($dbc, $q); + echo '
User NameScore
'; + echo ' + + + '; - echo ''; + while($row2 = mysqli_fetch_array($r2)) + echo $row2['user_name']; - //score - echo ''; + 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($row = mysqli_fetch_array($r)) + { + echo '
'; - while($row2 = mysqli_fetch_array($r2)) - { - echo $row2['user_name']; - } + $q2 = "select user_name from users where user_id='" + . $row['user_id'] . "' limit 1"; + $r2 = mysqli_query($dbc, $q2); - echo '' . $row['score'] . '
'; + //score + echo '' . $row['score'] . ''; } - - - -?> \ No newline at end of file + echo ''; +} \ No newline at end of file diff --git a/games/zombiePanda.html b/games/zombiePanda.html index 146ce62..b40c35f 100644 --- a/games/zombiePanda.html +++ b/games/zombiePanda.html @@ -1,396 +1,391 @@ + window.addEventListener("keyup", function (event) + { + delete keysDown[event.keyCode]; + }); + animate(tic); +} +
-
\ No newline at end of file +
\ No newline at end of file diff --git a/games/zombiePanda.php b/games/zombiePanda.php index e91a0f2..0aeb171 100644 --- a/games/zombiePanda.php +++ b/games/zombiePanda.php @@ -1,37 +1,33 @@ '; - echo '
'; - include('zombiePanda.html'); +//ini_set('display_errors', 1); +include '../includes/header.php'; - echo '
'; - //include('../includes/profile.php'); - include('highscore.php'); - - - echo '
'; +echo '
'; +echo '
'; +include('zombiePanda.html'); - echo '
'; - echo '
'; - //edit user - include('../user/profile.php'); +echo '
'; +//include('../includes/profile.php'); +include('highscore.php'); +echo '
'; - echo '
'; - include('userscores.php'); - echo '
'; +echo '
'; +echo '
'; +//edit user +include('../user/profile.php'); - include '../includes/footer.php'; - -?> \ No newline at end of file + +echo '
'; +include('userscores.php'); +echo '
'; + +include '../includes/footer.php'; \ No newline at end of file diff --git a/includes/footer.php b/includes/footer.php index 55e6b69..4208e63 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -39,7 +39,4 @@ function openNav() { - diff --git a/includes/header.php b/includes/header.php index d0ab746..c4bcf5d 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,133 +1,69 @@ + + +Club Panda + +'; + +if($dir == 2) +{ echo ' Club Panda '; - - if($dir == 2) - { - echo ' - - - Club Panda - - '; - echo '' - . ''; - echo ' - - - - + echo '' + . ''; + echo ' + - - - - -
-
- - Home - About -
- - -
-
- - - -
- - -
- boat - -
'; - - } - else - { - echo ' - - - Club Panda - - '; - echo '' - . ''; - echo ' - - @@ -136,8 +72,8 @@ Close - Bamboo Field - Zombie Pandas + Bamboo Field + Zombie Pandas Link 3 Link 4 Link 5 @@ -147,13 +83,13 @@
- Home - About + Home + About @@ -161,20 +97,75 @@
- boat + boat
'; - - } - +} +else +{ + echo ' + + + Club Panda + + '; + echo '' + . ''; + echo ' + + + + + + + + + +
+
+ + Home + About +
+ + +
+
+ + + +
+ + +
+ boat + +
'; -?> \ No newline at end of file +} \ No newline at end of file diff --git a/index.php b/index.php index 82de540..8846ffe 100644 --- a/index.php +++ b/index.php @@ -1,53 +1,54 @@ '; - echo '
'; - - - //new game or something - //include 'games/bamboofield.html'; - - echo '
'; - //profile - include('user/profile.php'); - echo '
'; - } - else - { - //profile(login) & register - echo '
'; - echo '
'; - - - //register - include('user/register.php'); - - echo '
'; - //profile - include('user/profile.php'); - echo '
'; - } - - //4-row - echo '
'; - echo '
'; - echo ''; - echo '
'; - - echo '
'; - echo ' - '; - echo '
'; - - include 'includes/footer.php'; - -?> \ No newline at end of file +//ini_set('display_errors', 1); + + +include 'includes/header.php'; + +if($loggedIn) +{ + //profile + echo '
'; + echo '
'; + + + //new game or something + //include 'games/bamboofield.html'; + + echo '
'; + //profile + include('user/profile.php'); + echo '
'; +} +else +{ + //profile(login) & register + echo '
'; + echo '
'; + + + //register + include('user/register.php'); + + echo '
'; + //profile + include('user/profile.php'); + echo '
'; +} + +//4-row +echo '
'; +echo '
'; +echo ''; +echo '
'; + +echo '
'; +echo ' +'; +echo '
'; + +include 'includes/footer.php'; \ No newline at end of file diff --git a/user/editUser.php b/user/editUser.php index 7e59aa5..5fdada9 100644 --- a/user/editUser.php +++ b/user/editUser.php @@ -1,102 +1,110 @@
Edit User
'; - - echo '
'; - - $q = "select user_name from users"; + $i_username = mysqli_real_escape_string($dbc, + trim($_POST['edit_user_username'])); + + $i_first = mysqli_real_escape_string($dbc, + trim($_POST['edit_user_first'])); + + $i_last = mysqli_real_escape_string($dbc, + trim($_POST['edit_user_last'])); + + $i_password = mysqli_real_escape_string($dbc, + trim($_POST['edit_user_pass'])); + + $i_admin = mysqli_real_escape_string($dbc, + trim($_POST['edit_user_admin'])); + + $passcom = $i_password . $i_first; + + $passcom = SHA1($passcom); + + if($i_admin) + $admin_temp = "true"; + else + $admin_temp = "false"; + + $q = "select user_id from users where user_name ='$i_username'"; $r = mysqli_query($dbc, $q); - echo ''; - - echo '
- - -
-
- - -
-
- - -
- - -
'; diff --git a/user/register.php b/user/register.php index d535d84..a13bb99 100644 --- a/user/register.php +++ b/user/register.php @@ -1,91 +1,90 @@
Register
'; + + echo '
- echo '

Register

'; - - echo ' - -
- - -
-
- - -
-
- - -
- - -
- - -
- - -

- - +
+ + +
+
+ + +
+
+ + +
-
'; + +
+ + +
- foreach($errors as $msg) - { - echo " - $msg
"; - } - } - - -?> \ No newline at end of file + +

+ + '; + + foreach($errors as $msg) + echo " - $msg
"; + +} \ No newline at end of file diff --git a/user/users.php b/user/users.php index c43d9b3..be536b5 100644 --- a/user/users.php +++ b/user/users.php @@ -1,71 +1,61 @@
Users
'; - - $q = "select * from users order by first_name asc"; + $i_id = mysqli_real_escape_string($dbc, trim($_POST['del_user_id'])); + + $q = "delete from users where user_id='$i_id'"; + $r = mysqli_query($dbc, $q); - - echo '
'; - echo ' - - - - - - '; - - while($row = mysqli_fetch_array($r)) - { - echo ''; - - //first name - echo ''; - - //last name - echo ''; - - //username - echo ''; - - //admin - if($row['admin']) - { - echo ''; - } - else - { - echo ''; - } - - - //del - echo ''; - - - echo ''; - } - - echo '
First NameLast NameUser NameAdmin
Delete User
' . $row['first_name'] . '' . $row['last_name'] . '' . $row['user_name'] . 'TrueFalse'; - echo '
- - - -
'; - echo '
'; + + header("Location: admin.php"); + } + echo '

Users

'; + + $q = "select * from users order by first_name asc"; + $r = mysqli_query($dbc, $q); + + echo '
'; + echo ' + + + + + + '; + + while($row = mysqli_fetch_array($r)) + { + echo ''; + + //first name + echo ''; + + //last name + echo ''; + + //username + echo ''; + + //admin + if($row['admin']) + echo ''; + else + echo ''; + + + echo ''; } -?> \ No newline at end of file + echo '
First NameLast NameUser NameAdmin
Delete User
' . $row['first_name'] . '' . $row['last_name'] . '' . $row['user_name'] . 'TrueFalse
+ + +
'; +} \ No newline at end of file