-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.php
133 lines (104 loc) · 5.42 KB
/
index.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
<?php
session_start();
$token = md5(time());
$_SESSION['token'] = $token;
include_once 'db.inc.php';
$query1 = mysql_query("SELECT * FROM users WHERE kscore != 0 AND kscore != -1 ORDER BY kscore DESC, twitter_screen_name"); // ranked
$query2 = mysql_query("SELECT * FROM users"); // all
$nb = mysql_num_rows($query2);
$users = array();
$i = 0;
$prev_score = 0;
$prev_pos = 0;
while ($user = mysql_fetch_assoc($query1)) {
if ($prev_score == $user['kscore']) {
$user['pos'] = $prev_pos;
}
else {
$user['pos'] = $i+1;
$prev_score = $user['kscore'];
$prev_pos = $user['pos'];
}
$users[] = $user;
$i++;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Belgians on Klout — Ranking of the most influential people in Belgium</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="Ranking of Belgian influencers on Klout">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" media="screen" href="_css/main.css" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 900px)" href="_css/900.css" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 650px)" href="_css/650.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="_js/main.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-192063-4']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<aside>
<div id="logo"><img src="_img/klout_be.png" alt="Belgians on Klout"></div>
<div id="description">
<p>Ranking of Belgian influencers on <a href="http://www.klout.com" target="_blank">Klout</a>. Inspired by <a href="http://datanews.rnews.be/fr/ict/actualite/blog/qui-devez-vous-suivre-dans-la-twittosphere-belge/article-1195010830793.htm" target="_blank">Data News</a> and initially based on <a href="https://twitter.com/Marievh/belgessurtwitter" target="_blank">this Twitter list</a>. <strong><?php echo $nb ?></strong> Belgians ranked so far. Updated very frequently. </p>
<div id="add">
<form method="post" action="submit.php">
<div>
<input type="text" name="twitter_screen_name" value="" id="input_twitter_screen_name" />
<input type="hidden" name="token" value="<?php echo $token ?>" id="input_token" />
<button>Submit</button>
</div>
</div>
<p class="note">Made with ♥ by <a href="http://twitter.com/vinch01" target="_blank">Vincent Battaglia</a> during Wimbledon 2011 men's final. This experiment is <a href="http://github.com/vinch/kloutbe" target="_blank">forkable on GitHub</a>.</p>
</div>
<div id="share">
<div class="share">
<iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&app_id=158701270868874&href=http%3A%2F%2Fv1n.ch%2Fklout.be%2F&send=false&layout=box_count&width=50&show_faces=false&action=like&colorscheme=light&font&height=62" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:62px;" allowTransparency="true"></iframe>
</div>
<div class="share">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://v1n.ch/klout.be/" data-count="vertical" data-via="vinch01">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
<div class="share">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<g:plusone size="tall" href="http://v1n.ch/klout.be/"></g:plusone>
</div>
</div>
</aside>
<?php if (count($users) == 0) : ?>
<p style="font-size:14px;">The ranking is currently down. Please come back later.</p>
<?php else : ?>
<table cellspacing="0" cellpadding="0">
<?php foreach ($users as $key => $user) : ?>
<tr<?php if ($key%2 == 0) echo ' class="even"' ?>>
<td class="pos"><strong><?php echo $user['pos'] ?></strong></td>
<td class="name"><a href="http://twitter.com/<?php echo $user['twitter_screen_name'] ?>" target="_blank"><?php echo $user['twitter_screen_name'] ?></a></td>
<td class="score"><strong><?php echo ($user['kscore'] != -1) ? number_format($user['kscore'], 2) : 'N/A' ?></strong></td>
<td class="change"><strong><?php echo (($user['kchange'] < 0) ? '▼' : (($user['kchange'] == 0) ? '-' : '▲')); ?></strong></td>
<!--td class="force"><a href="force.php?u=<?php echo $user['kid'] ?>"><img src="_img/refresh.gif" /></a></td-->
<td class="klout"><a href="http://klout.com/<?php echo $user['twitter_screen_name'] ?>" target="_blank"><img src="_img/icon.png" /></a></td>
</tr>
<?php endforeach; ?>
</table>
<p style="font-size:14px;padding-top:20px;">People not having a Klout score are not shown.</p>
<?php if (isset($_GET['u']) && isset($_GET['s'])) : ?>
<script type="text/javascript">
alert("Score for <?php echo $_GET['u'] ?> is now <?php echo $_GET['s'] ?>!");
</script>
<?php endif; ?>
<?php endif; ?>
</body>
</html>