-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaderboard.php
70 lines (62 loc) · 2.08 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
<?php
/*
* The landing page that lists all the problem
*/
require_once('functions.php');
if(!loggedin())
header("Location: login.php");
else
include('header.php');
connectdb();
?>
<div class="container">
<?php
if(isset($_GET['share']))
echo("<div class=\"alert alert-info\">\nYour Ride was succesfully added! You can edit it from your profile\n</div>");
else if(isset($_GET['nerror']))
echo("<div class=\"alert alert-error\">\nPlease enter all the details asked before you can continue!\n</div>");
?>
<?php
include('menu.php');
?>
<div class="row-fluid" id="main-content">
<div class="span3"></div>
<div class="span6">
<?php
$connection = mysqli_connect('localhost:2023', 'root', '', 'carpool'); // Replace with your database credentials
$query = "SELECT * FROM users ORDER BY credits DESC";
$result = mysqli_query($connection, $query);
echo '<table id="userlist" class="table table-hover">
<thead><tr> <th>Id</th> <th>Name</th> <th>Carbon Credits</th> </tr></thead>
<tbody>';
while ($row = mysqli_fetch_array($result)) {
echo '<tr><td>' . $row['uid'] . '</td><td>' . $row['name'] . '</td><td>' . $row['credits'] . '</td></tr>';
}
?>
</tbody>
</table>
</div>
<div class="span3"></div>
</div>
</div>
<div id="push"></div>
</div> <!-- /wrap -->
<div id="footer">
<div class="container">
<p class="muted credit">Built with love by <a href="about.php">@sushant @ashish @nilesh.</a></p>
</div>
</div>
<!-- javascript files
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/datetimepicker.js"></script>
<script type="text/javascript">
$('td:nth-child(1),th:nth-child(1)').hide();
$('#userlist').find('tr').click( function(){
var row = $(this).find('td:first').text();
window.location.href = "profile.php?uid="+row;
});
</script>
</body></html>