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
/
scoreboard.php
57 lines (55 loc) · 1.88 KB
/
scoreboard.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
<?php
/*
* Codejudge
* Copyright 2012, Sankha Narayan Guria (sankha93@gmail.com)
* Licensed under MIT License.
*
* Scoreboard 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><a href="submissions.php">Submissions</a></li>
<li class="active"><a href="#">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">
The current standings of all the participants, the number of problems they have attempted and solved.
<table class="table table-striped">
<thead><tr>
<th>Name</th>
<th>Solved</th>
<th>Attempted</th>
</tr></thead>
<tbody>
<?php
$query = "SELECT username, status FROM users WHERE username!='admin'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
// displays the user, problems solved and attempted
$sql = "SELECT * FROM solve WHERE (status='2' AND username='".$row['username']."')";
$res = mysql_query($sql);
echo("<tr><td>".$row['username']." ");
if($row['status'] == 0) echo("</a> <span class=\"label label-important\">Banned</span>");
echo("</td><td><span class=\"badge badge-success\">".mysql_num_rows($res));
$sql = "SELECT * FROM solve WHERE (status='1' AND username='".$row['username']."')";
$res = mysql_query($sql);
echo("</span></td><td><span class=\"badge badge-warning\">".mysql_num_rows($res)."</span></td></tr>");
}
?>
</tbody>
</table>
</div> <!-- /container -->
<?php
include('footer.php');
?>