-
Notifications
You must be signed in to change notification settings - Fork 0
/
puzzlelist.php
118 lines (98 loc) · 4.72 KB
/
puzzlelist.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<?php
require('dbconfig.php');
session_start();
?>
<html>
<head>
<title> Registration </title>
<link rel="stylesheet" type="text/css" href="stylesheets/crate.css">
</head>
<body class="list">
<div id="main">
<div id="header">
<header class="wrapper clearfix">
<div class="center">
<h1 class="title">CRA</h1>
<img src="bobcat1.gif" alt="" />
<img src="boxtarget3inverse.png" alt="" />
<h1 class="title"> </h1>
<h1 class="title">GAM</h1>
<img src="boxtarget3inverse.png" alt="" />
</div>
</header>
</div>
<nav class="navigation">
<ul>
<li><a href="index.php" class="list">Home</a></li>
<li><a href="puzzlelist.php" class="list">Puzzle List</a></li>
<?php
if(isset($_SESSION['name']))
{
echo '<li><a href="logout.php" class="login">' . "Logout" . '</a></li>' ;
echo '<li class="username">' .'Logged in as user: '. $_SESSION['name'] . '</li>' ;
}
else
{
echo '<li><a href="registration.php" class="registration">Registration</a></li>' ;
echo '<li><a href="login.php" class="login">Login</a></li>';
}
?>
</ul>
</nav>
<div id="container3">
<div id="container2">
<div id="container1">
<div id="col1">
</div>
<div id="col2">
<h1> ScoreBoard </h1> <br/>
<div id="puzzlelist">
<?php
$connect = mysqli_connect($server, $user, $pass, $db);
if(!$connect)
{
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$result = $connect->query("select min(score) total,seedlev,puzname,name,recname from puzzles group by puzname");
if(!$result)
{
die("results have not been fetched");
exit();
}
?>
<table class="cratetable" >
<th>Puzzle Name</th>
<th>Game Creator</th>
<th>Record Holder</th>
<th>Score</th>
<?php
//echo nl2br("PuzzleName ==> Name , Recname ===> Score \n\n") ;
echo "<tr>" ;
echo '<td><a href="newpuzzle.php" class="button">' . 'Create New Puzzle </a></td>';
echo '<td>' . "" . "</a></td>";
echo '<td>' . "" . "</a></a></td>";
echo '<td>' . "" . "</a></td>";
echo "</tr>" ;
while($row = $result->fetch_array(MYSQLI_ASSOC))
{
echo "<tr>" ;
echo '<td><a href="crategame.php?seed=' .$row["seedlev"]. '&recscore=' . $row["total"] . '&puzname=' . $row["puzname"] . '" class="button">Play ' . $row["puzname"] . "</a></td>";
echo '<td>' . $row["name"] . "</a></td>";
echo '<td>' . $row["recname"]. "</a></td>";
echo '<td>' . $row["total"]. "</a></td>";
echo "</tr>" ;
}
?>
</table>
</div>
</div>
<div id="col3">
</div>
</div>
</div>
</div>
</div>
</body>
</html>