-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaderboard.php~
135 lines (124 loc) · 3.88 KB
/
leaderboard.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
* Created by PhpStorm.
* User: ARVIND
* Date: 16-Aug-16
* Time: 10:50 AM
*/
require_once 'core/init.php';
$user = new User();
if(!$user->isLoggedIn())
Redirect::to('index.php');
$db = DB::getInstance();
$res = $db->query("SELECT `score`,`name`,`school`,`avtar`,`user_id` FROM `user_score` INNER JOIN `users` ON `user_score`.`user_id`=`users`.`id` ORDER BY `score` DESC",array());
$rows = $res->results();
if(isset($_GET['api']))
{
header('Content-Type: application/json');
$needed = "";
foreach($rows as $index => $row){
// if($row->user_id == $user->data()->id){
if(1){
//$needed= 1;
$needed = array('pos' => $index+1, 'score' => $row->score);
// $needed = "Shubh";
break;
}
}
echo json_encode($needed);
// $needed= 'Shukla';
// echo $needed;
die();
}
?>
<!doctype html>
<html>
<head>
<title>Infotsav'16 | ABV IIITM</title>
<meta name="description" content="Infotsav Annual Techno-Managerial Fest ABV IIITM">
<meta name="keywords" content="Infotsav, ABV IIITM, techfest, Techno, Managerial, Techno-Managerial, Events, Coding, Robofiesta, Robotics, Qiuz">
<meta property="og:image" content="shareImg.jpg" />
<link rel="SHORTCUT ICON" href="favicon.png">
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<style>
@font-face {
font-family: 'SilkscreenBold';
src: url('fonts/slkscrb-webfont.eot');
src: url('fonts/slkscrb-webfontd41d.eot?#iefix') format('embedded-opentype'),
url('fonts/slkscrb-webfont.woff') format('woff'),
url('fonts/slkscrb-webfont.ttf') format('truetype'),
url('fonts/slkscrb-webfont.svg#SilkscreenBold') format('svg');
font-weight: normal;
font-style: normal;
}
body
{
background: url('images/bgnl.jpg') no-repeat;
background-size: cover;
font-family: SilkscreenBold;
}
.table
{
opacity:0.8;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
margin-top: 30px;
background-color: #fff;
}
.table-bordered, .table-responsive,.table-striped{
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
}
h2
{
color: #fff;
}
</style>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-xs-3"></div>
<div class="col-xs-6 text-center">
<h2>CURRENT LEADERBOARD</h2>
</div>
<div class="col-xs-3"></div>
</div>
<div class="row">
<div class="col-xs-1"></div>
<div class="col-xs-10">
<table class="table table-bordered table-responsive table-inverse">
<tr>
<th>#</th>
<th>Name</th>
<th>Score</th>
<th>Institute/School/College</th>
</tr>
<?php
foreach($rows as $pos => $row){
//if($row->active == '1')
if(1)
{
if($row->user_id === $user->data()->id)
{
if($pos == 0)
echo '<tr class="success">';
else
echo "<tr class='info'>";
}
else
echo '<tr>';
$lbpos = $pos+1;
echo "<td>{$lbpos}</td><td>{$row->name}</td><td>$row->score</td><td>$row->school</td></tr>";
}
}
?>
</table>
</div>
<div class="col-xs-1"></div>
</div>
</div>
</body>
</html>