This repository has been archived by the owner on Mar 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
submissions.php
59 lines (57 loc) · 1.91 KB
/
submissions.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
<?php
/*
* Codejudge
* Copyright 2012, Sankha Narayan Guria ([email protected])
* Licensed under MIT License.
*
* Submissions List page
*/
require_once('functions.php');
if(!loggedin())
header("Location: login.php");
else
include('header.php');
connectdb();
?>
<li><a href="index.php">Problems</a></li>
<li class="active"><a href="#">Submissions</a></li>
<li><a href="scoreboard.php">Scoreboard</a></li>
<li><a href="account.php">Account</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
Below is a list of submissions you have made. Click on any to edit it.
<table class="table table-striped">
<thead><tr>
<th>Problem</th>
<th>Attempts</th>
<th>Status</th>
</tr></thead>
<tbody>
<?php
// list all the submissions made by the user
$query = "SELECT problem_id, status, attempts FROM solve WHERE username='".$_SESSION['username']."'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
$sql = "SELECT name FROM problems WHERE sl=".$row['problem_id'];
$res = mysql_query($sql);
if(mysql_num_rows($res) != 0) {
$field = mysql_fetch_array($res);
echo("<tr><td><a href=\"solve.php?id=".$row['problem_id']."\">".$field['name']."</a></td><td><span class=\"badge badge-info\">".$row['attempts']);
if($row['status'] == 1)
echo("</span></td><td><span class=\"label label-warning\">Attempted</span></td></tr>\n");
else if($row['status'] == 2)
echo("</span></td><td><span class=\"label label-success\">Solved</span></td></tr>\n");
}
}
?>
</tbody>
</table>
</div> <!-- /container -->
<?php
include('footer.php');
?>