forked from vinch/kloutbe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
113 lines (92 loc) · 4.73 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
<?php
session_start();
$token = md5(time());
$_SESSION['token'] = $token;
include_once 'db.inc.php';
$query = mysql_query("SELECT * FROM users ORDER BY kscore DESC, twitter_screen_name");
$nb = mysql_num_rows($query);
$users = array();
$i = 0;
$prev_score = 0;
$prev_pos = 0;
while ($user = mysql_fetch_assoc($query)) {
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=60" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:60px;" 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>
<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 number_format($user['kscore'], 2) ?></strong></td>
<td class="change"><strong><?php echo (($user['kchange'] < 0) ? '▼' : (($user['kchange'] == 0) ? '-' : '▲')); ?></strong></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>
</body>
</html>