-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserlist.php
More file actions
118 lines (109 loc) · 4.62 KB
/
userlist.php
File metadata and controls
118 lines (109 loc) · 4.62 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
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
<?php
//SELECT `user`.`name`,`user`.`url`,`daily_update`.`points`,`daily_update`.`rank` FROM `daily_update`,`user` WHERE `user`.`uid`=`daily_update`.`uid` and `daily_update`.`r_date`='2016-09-25'
$link = mysqli_connect('localhost','root','','mini');
if (!$link) {
die('Could not connect to MySQL: ' . mysql_error());
}
$qry="SELECT `user`.`uid`,`user`.`name`,`user`.`uname`,`user`.`url`,`daily_update`.`points`,`daily_update`.`rank` FROM `daily_update`,`user` WHERE `user`.`uid`=`daily_update`.`uid` and `daily_update`.`r_date`='".date('Y-m-d')."' ORDER BY `daily_update`.`points` DESC";
$qry2=mysqli_query($link,$qry) or die (mysqli_error($link));
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="node_modules\bootstrap\dist\css\bootstrap.css">
<link rel="stylesheet" type="text/css" href="node_modules\bootstrap\dist\css\animate.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="node_modules\bootstrap\dist\js\bootstrap.js"></script>
<style>
body{
background-image:url("img/bg2.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
color: #fff;
}
table{
padding-top: 15px;
}
a:link{
color: #bbd0f7;
}
a:visited{
color: #fff;
}
.table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
background-color: #000;
}
</style>
</head>
<body >
<!--navigation menu start-->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="index.php">FCC Status Viewer</a>
</div>
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li class="active"><a href="userlist.php">User List</a></li>
<li><a href="http://fcc-status.herokuapp.com" target="_blank">Live View</a></li>
<li><a href="userprofile.php">User Profile</a></li>
<li><a href="userexcluder.php">User Excluder</a></li>
<li><a href="activity.php">Activity Report</a></li>
<li><a href="message.php">Message to Campsite</a></li>
</ul>
</div>
</nav>
<!--navigation menu end-->
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 text-center">
<h1><span class="label label-primary col-lg-12">User List</span></h1>
</div>
</div>
</div>
<br/>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 ">
<table class="table table-hover text-center">
<tr>
<th class="text-center"><h3>Rank</h3></th>
<th colspan="2" class="text-center"><h3>Name</h3></th>
<th class="text-center"><h3>points</h3></th>
<th class="text-center" colspan="2"><h3>link to FCC</h3></th>
</tr>
<?php
while($row = mysqli_fetch_array($qry2, MYSQL_ASSOC)) {
$name=$row['name'];
$url=$row['url'];
$points=$row['points'];
$rank=$row['rank'];
$uname=$row['uname'];
$uid=$row['uid'];
$qry3="SELECT `points` FROM `daily_update` WHERE `uid`='".$uid."' and `r_date`='".date('Y-m-d',strtotime("-1 days"))."'";
$qry4=mysqli_query($link,$qry3) or die (mysqli_error($link));
while($row2 = mysqli_fetch_array($qry4, MYSQL_ASSOC)) {
$rank_old= $row2['points'];
}
if($rank_old==null or !$rank_old)
$rank_old=0;
if($points > $rank_old)
$img="img/up.png";
else if($points < $rank_old)
$img="img/down.png";
else
$img="img/equal.png";
echo "<tr>
<td><h2>#".$rank."</h2></td>
<td><img src=\"".$url."\" width=\"75px\" height=\"75px\"/></td>
<td><h2>".$name."</h2></td>
<td><h2>".$points."</h2></td>
<td><img src=\"".$img."\" width=\"75px\" height=\"75px\"/></td>
<td><h2><a href=\"https://www.freecodecamp.com/".$uname."\" target=\"_blank\">".$uname."</a></h2></td>
</tr>";
}
?>
</table>
</div>
</div>
</div>
</body>