/
rankamongfriends.php
182 lines (103 loc) · 3.58 KB
/
rankamongfriends.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
// session_start();
// include('include/fbapi.php');
include("functions.php");
// if(!isset($_SESSION['access_token'])) {
// $dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
// . $app_id . "&redirect_uri=" . urlencode($my_url) . "&scope=user_birthday,email,read_stream,user_education_history,read_friendlists";
// echo("<script> top.location.href='" . $dialog_url . "'</script>");
// }
$con=connect();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Website Template by freewebsitetemplates.com -->
<html>
<head>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Cryptex , Phoenix 2012</title>
<meta name="keywords" content="" />
<meta name="Gestured" content="" />
<style type="text/css">
@font-face
{
font-family: extras;
src: url('fonts/Roboto-Light.woff');
}
#contents
{
font-family: extras;
margin-left:20px;
margin-right: 60px;
max-height: 600px;
overflow:scroll;
}
#num{
font-family: arial;
}
td{
text-align:center;
}
</style>
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="background">
<div id="header">
<?php
include("include/header.php");
?>
</div><div id="body">
<div>
<div>
<div id="contents" >
<?php
include("include/sidemenu.php");
?>
<br/>
<center><font color = "red" size = "180%"> Rank Among Friends</font></center>
<br/><br/>
<table cellspacing="2" cellpadding="2" align="center" width="60%" style="font-family: arial ;">
<tr style="text-align:center; ">
<th>Rank</th>
<th>Name</th>
<th>Level</th>
<th>College</th>
</tr>
<?php
$con = connect();
$rank = 1;
$graph_url = "https://graph.facebook.com/me/friends". '?fields=username,name&access_token=' . $_SESSION['access_token'];
$user = json_decode(file_get_contents($graph_url),true);
$query = "SELECT fb_id,username,level,college from register where username not in ('Shiva Sah','Dhruv Jagetiya','Ankit Gupta', 'Gaurav Yadav', 'Shuchit Khurana' ,'Manaswini Thakur', 'Kushagra Chandra', 'Aditya Sinha', 'Ra Hihoha') ORDER BY level desc , registertime asc";
$output = mysql_query($query);
if(isset($_SESSION['username']))
$usernames = $_SESSION['username'];
else{
$usernames = cleandata(extract_username());
$_SESSION['username'] = $usernames;
}
$name22=$usernames;
while($row = mysql_fetch_array($output)){
if($row['fb_id']==$name22)
echo "<tr style = 'background-color: green; font-weight: bold; font-color:white;'><td><font color = 'white'>".$rank++."</td><td ><font color = 'white'>".$row["username"]."</td><td><font color = 'white'>".$row["level"]."</td><td><font color = 'white'>".$row["college"]."</td></tr>";
else{
foreach($user['data'] as $x){
if(in_array($row['fb_id'],$x)){
if($row["level"] == 60) continue;
echo "<tr><td>".$rank++."</td><td>".$row["username"]."</td>";
//echo "<td><a href = 'https://www.facebook.com/".$row['fb_id']."'><img src = 'https://graph.facebook.com/" .$row['fb_id']."/picture'/></a></td>";
echo "<td>".$row["level"]."</td><td>".$row["college"]."</td></tr>";
}
}
}
}
?>
</table><br/><br/>
</div>
</div>
</div>
</div>
</div>
<?php include("include/footer.php"); ?>
</div>