-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathproblems.php
67 lines (67 loc) · 1.63 KB
/
problems.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
<?php
session_start();
ini_set('display_errors', 'On');
$dbhost = "localhost";
$dbuser = "agdhruv";
$dbpass = "haha";
$dbname = "onlineJudge";
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Thor · Problem Statements</title>
<link rel="stylesheet" href="css/nav.css">
<link rel="stylesheet" href="css/index.css">
</head>
<body>
<nav>
<h1 class="title">
Thor
</h1>
<div class="links">
<a href="index.php">Rank List</a>
<a href="problems.php">Problems</a>
<?php
if(isset($_SESSION["user"])){
echo '<a href="submit-code.php"><span>Submit Code</span></a>';
echo '<a href="javascript:void(0);"><span>'.$_SESSION["user"].'</span></a>';
echo '<a href="logout.php"><span>Logout</span></a>';
}
else{
echo '<a href="login.php"><span>Login</span></a>';
echo '<a href="register.php"><span>Register</span></a>';
}
?>
</div>
</nav>
<section class="section1">
<h1>List of Problems</h1>
<table class="rankTable">
<tr>
<th>Rank</th>
<th>Problem ID</th>
<th>Time Limit</th>
<th>Points</th>
</tr>
<?php
$query = "SELECT * FROM problems";
$result = mysqli_query($conn,$query);
$rank = 1;
while($data = mysqli_fetch_assoc($result)){
echo " <td>".$rank."</td>";
echo " <td><a href=flask/statements/".$data["PID"].".txt>".$data["PID"]."</a></td>";
echo " <td>".$data["timeout"]."</td>";
echo " <td>".$data["points"]."</td>";
echo "</tr>";
$rank++;
}
?>
</table>
</section>
</body>
<?php
mysqli_close($conn);
?>
</html>