-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmissions.php
More file actions
executable file
·48 lines (43 loc) · 1.65 KB
/
submissions.php
File metadata and controls
executable file
·48 lines (43 loc) · 1.65 KB
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
<?php
require_once('includes/bootstrap.php');
include('header.php');
$con = dbConnect();
?>
<!-- <div class="custom-table-container"> -->
<p align="center" style="font-size:25px; color: #2c2c2c">Submissions</p>
<hr>
<table class="bordered centered">
<thead>
<tr class="grey darken-1 white-text">
<th data-field="title">Problem</th>
<th data-field="attempts">Attempts</th>
<th data-field="status">Status</th>
</tr>
</thead>
<tbody>
<!-- Details of all submissions-->
<?php
$query = "SELECT problem_id, statusCode, attempts FROM submissions WHERE username='".$_SESSION['username']."'";
$results = mysqli_query($con, $query);
while($row = mysqli_fetch_assoc($results)) {
$sql = "SELECT title FROM problems WHERE id=".$row['problem_id'];
$res = mysqli_query($con, $sql);
if(mysqli_num_rows($res) != 0) {
$field = mysqli_fetch_assoc($res);
if($row['statusCode']==1) $status = '<span class="custom-label-status-nattempted">Attempted</span>';
else if($row['statusCode']==2) $status = '<span class="custom-label-status-solved">Solved</span>';
$url = "submit.php?id=".$row['problem_id'];
echo "
<tr>
<td><a href=\"{$url}\" style='font-size: 18px; color:darkblue'> {$field['title']} </a></td>
<td>{$row['attempts']}</td>
<td>$status</td>
</tr>
";
}
}
?>
</tbody>
</table>
</div>
<?php include('footer.php'); ?>