rank overhaul
This commit is contained in:
parent
6df859f963
commit
93a5f1c912
1 changed files with 25 additions and 17 deletions
|
@ -19,22 +19,20 @@
|
|||
}
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
foreach ($result as $usern) {
|
||||
$theuser = $usern['username'];
|
||||
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
|
||||
$stmt->execute([$theuser]);
|
||||
|
||||
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||
|
||||
foreach ($followers as $follown) {
|
||||
if ($usern == $follown['target']) continue;
|
||||
$pr[$usern['username']] += $pr[$follown['target']];
|
||||
}
|
||||
|
||||
$h = $pr[$usern['username']];
|
||||
|
||||
$pr[$usern['username']] = log($h/10 + 1)*10* M_E;
|
||||
foreach ($result as $usern) {
|
||||
$theuser = $usern['username'];
|
||||
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
|
||||
$stmt->execute([$theuser]);
|
||||
|
||||
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||
|
||||
foreach ($followers as $follown) {
|
||||
if ($usern == $follown['target']) continue;
|
||||
$pr[$usern['username']] += $pr[$follown['target']] / 10;
|
||||
}
|
||||
|
||||
$h = $pr[$usern['username']];
|
||||
}
|
||||
}
|
||||
|
||||
function cmp($a, $b) {
|
||||
|
@ -48,8 +46,18 @@
|
|||
|
||||
foreach ($pr as $usern => $rr) { ?>
|
||||
<div class='comment'>
|
||||
<b><?php echo $usern ?></b>
|
||||
<div>Rank: <?php echo (int)($rr * 10) ?></div>
|
||||
<div class="avatar">
|
||||
<img src="/pfp/<?php echo $usern ?>.png" class="avatar-img">
|
||||
<div>
|
||||
<div><b>
|
||||
<a class="link" href="/user.php?id=derv3">
|
||||
<?php echo $usern ?>
|
||||
</a>
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div><b>Rank</b>: <?php echo (int)($rr * 10) ?></div>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue