From 32471030d432eb8d3cef4af8bb00790f3b9f089c Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 17 Jun 2025 22:30:05 +0500 Subject: feat: we are using SQL databases now --- lib/partials.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/partials.php') diff --git a/lib/partials.php b/lib/partials.php index 5b94ce2..6c69c62 100644 --- a/lib/partials.php +++ b/lib/partials.php @@ -66,12 +66,14 @@ function html_mini_navbar() function html_footer() { - $files = glob(FILE_UPLOAD_DIRECTORY . "/*.*"); - $file_size = 0; + $db = new PDO(DB_URL, DB_USER, DB_PASS); + $stmt = $db->query('SELECT COUNT(*) AS file_count, SUM(size) AS file_overall_size FROM files'); + $stmt->execute(); - foreach ($files as $file) { - $file_size += filesize($file); - } + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + $file_count = $row['file_count']; + $file_size = $row['file_overall_size']; $suffix = 'MB'; $file_size /= 1024 * 1024; // MB @@ -119,7 +121,7 @@ function html_footer()

[Tor]

-

Serving files and of active content

+

Serving files and of active content