-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathratings.php
More file actions
77 lines (76 loc) · 2.17 KB
/
ratings.php
File metadata and controls
77 lines (76 loc) · 2.17 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
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
<?php
session_start();
if(!$_SESSION['user']){
header('Location: index.php');
}
require_once 'includes/connect.php';
$cur_usr=$_SESSION['user']['login'];
$cur_usr_ratings=mysqli_query($connect,"SELECT * FROM rating WHERE `user`='$cur_usr' ORDER BY score DESC");
$table=mysqli_query($connect,"SELECT * FROM rating ORDER BY score DESC ");
include "views/header.php";
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/home.css">
<title>Document</title>
</head>
<body>
<div class="rate">
<h2>All time users ratings</h2>
<table class="table">
<thead>
<th>User</th>
<th>Test</th>
<th>Score</th>
</thead>
<tbody>
<?php /** @var TYPE_NAME $res */
while ($res=mysqli_fetch_array($table)){?>
<tr>
<td>
<?= $res['user']?>
</td>
<td>
<?= $res['test']?>
</td>
<td>
<?= $res['score']?>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class="rate">
<h2>Your ratings</h2>
<table class="table">
<thead>
<th>User</th>
<th>Test</th>
<th>Score</th>
</thead>
<tbody>
<?php /** @var TYPE_NAME $res */
while ($res=mysqli_fetch_array($cur_usr_ratings)){?>
<tr>
<td>
<?= $res['user']?>
</td>
<td>
<?= $res['test']?>
</td>
<td>
<?= $res['score']?>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</body>
</html>