From 61cdb6775ed206ece95d26c8faf58635db23d393 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Thu, 23 Jan 2025 20:00:36 -0500 Subject: [PATCH] test stats --- docs/index.php | 1 + docs/stats.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) mode change 100755 => 100644 docs/index.php create mode 100755 docs/stats.php diff --git a/docs/index.php b/docs/index.php old mode 100755 new mode 100644 index e23e33b..792031e --- a/docs/index.php +++ b/docs/index.php @@ -13,6 +13,7 @@

Community

Terms of Use + Top Users More Projects diff --git a/docs/stats.php b/docs/stats.php new file mode 100755 index 0000000..b24668f --- /dev/null +++ b/docs/stats.php @@ -0,0 +1,52 @@ +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; + } + } + foreach ($result as $usern) { ?> +
+ +
Rank:
+
+ + +