2025-01-23 20:00:36 -05:00
|
|
|
<?php
|
|
|
|
require(__DIR__ . "/../libs/page.php");
|
|
|
|
require(__DIR__ . "/../libs/form.php");
|
|
|
|
require(__DIR__ . "/../libs/comment.php");
|
|
|
|
|
|
|
|
page_header();
|
|
|
|
|
|
|
|
function get_handler() {
|
|
|
|
global $db;
|
|
|
|
|
|
|
|
$stmt = $db->prepare("SELECT * FROM main.auth"); //weirdly, this requires a schema name
|
|
|
|
$stmt->execute([]);
|
|
|
|
$result = $stmt->fetchAll(PDO::FETCH_DEFAULT);
|
|
|
|
|
|
|
|
$pr = array();
|
|
|
|
|
|
|
|
foreach ($result as $usern) {
|
|
|
|
$pr[$usern['username']] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2025-01-23 20:04:50 -05:00
|
|
|
|
|
|
|
function cmp($a, $b) {
|
|
|
|
if ($a == $b) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ($a > $b) ? -1 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
uasort($pr,'cmp');
|
|
|
|
|
|
|
|
foreach ($pr as $usern => $rr) { ?>
|
2025-01-23 20:00:36 -05:00
|
|
|
<div class='comment'>
|
2025-01-23 20:04:50 -05:00
|
|
|
<b><?php echo $usern ?></b>
|
|
|
|
<div>Rank: <?php echo (int)($rr * 10) ?></div>
|
2025-01-23 20:00:36 -05:00
|
|
|
</div>
|
|
|
|
<?php }
|
|
|
|
}
|
|
|
|
|
|
|
|
get_handler();
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
page_footer();
|
|
|
|
?>
|