-
Notifications
You must be signed in to change notification settings - Fork 0
/
games.php
97 lines (95 loc) · 3.71 KB
/
games.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* Created by PhpStorm.
* User: ryanh
* Date: 7/28/2018
* Time: 10:10 PM
*/
session_start();
include 'connection.php';
if(!isset($_SESSION['username'])){
header("Location:login.php");
}
?>
<html id="html">
<head>
<title>Game Swap</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/post.css">
<link rel="stylesheet" href="css/all.min.css">
</head>
<body id="body">
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" style="background-color: black">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="home.php"><i class="fas fa-gamepad"></i> Game Swap</a>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="home.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="myposts.php">My Posts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="newpost.php">New Post</a>
</li>
<li class="nav-item">
<a class="nav-link" href="users.php">Users</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="games.php">All Games</a>
</li>
<li class="nav-item">
<?php
echo "<a class=\"nav-link\" href=\"messages.php\">Inbox(";
$sqlunread = "SELECT * FROM messages where receiver =\"".$_SESSION["username"]."\" and msgread = 'no' order by time desc";
$unread = mysqli_query($conn, $sqlunread);
echo mysqli_num_rows($unread);
echo ")</a>";
?>
</li>
</ul>
<ul class="navbar-nav ml-auto my-2 my-lg-0">
<li class="nav-item">
<a class="nav-link" href="myinfo.php"><?php
echo "<i class=\"fas fa-user\"></i> " .$_SESSION['username'].""
?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">Log Out <i class="fas fa-sign-out-alt"></i></a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container" id="posts">
<?php
$sql = "SELECT gamename FROM games order by gamename";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "<div id='post'>
<h1>" . $row["gamename"]. "</h1><br>
<form action='gameinfo.php' method='post'>
<div class='form-group'>
<input type='hidden' class='form-control' name='gamename' id='gamename' value=\"".$row["gamename"]."\">
</div>
<button type='submit' class='btn btn-success'>Game Details</button>
</form>
</div>";
}
} else {
echo "0 results";
echo "<div style='margin-bottom: 1000px'>
</div>";
}
mysqli_close($conn);
?>
</div>
<script type="text/javascript" src="js/home.js"></script>
</body>
</html>