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++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
foreach ($result as $usern) {
|
foreach ($result as $usern) {
|
||||||
$theuser = $usern['username'];
|
$theuser = $usern['username'];
|
||||||
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
|
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
|
||||||
$stmt->execute([$theuser]);
|
$stmt->execute([$theuser]);
|
||||||
|
|
||||||
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
||||||
|
|
||||||
foreach ($followers as $follown) {
|
foreach ($followers as $follown) {
|
||||||
if ($usern == $follown['target']) continue;
|
if ($usern == $follown['target']) continue;
|
||||||
$pr[$usern['username']] += $pr[$follown['target']];
|
$pr[$usern['username']] += $pr[$follown['target']] / 10;
|
||||||
}
|
|
||||||
|
|
||||||
$h = $pr[$usern['username']];
|
|
||||||
|
|
||||||
$pr[$usern['username']] = log($h/10 + 1)*10* M_E;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$h = $pr[$usern['username']];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmp($a, $b) {
|
function cmp($a, $b) {
|
||||||
|
@ -48,8 +46,18 @@
|
||||||
|
|
||||||
foreach ($pr as $usern => $rr) { ?>
|
foreach ($pr as $usern => $rr) { ?>
|
||||||
<div class='comment'>
|
<div class='comment'>
|
||||||
<b><?php echo $usern ?></b>
|
<div class="avatar">
|
||||||
<div>Rank: <?php echo (int)($rr * 10) ?></div>
|
<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>
|
</div>
|
||||||
<?php }
|
<?php }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue