2021-04-01 11:40:36 +02:00
|
|
|
<?php
|
|
|
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|
|
|
require "$root/database/credentials.php";
|
|
|
|
|
|
|
|
// Connect the database
|
|
|
|
try {
|
|
|
|
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
|
|
|
|
$user,
|
|
|
|
$password,
|
|
|
|
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
|
|
|
));
|
|
|
|
} catch (Exception $e) {
|
|
|
|
die("Error : ".$e->getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
$req = $db->prepare('SELECT COUNT(*) AS counter FROM `records`');
|
|
|
|
$req->execute();
|
|
|
|
if ($data = $req->fetch()) {
|
|
|
|
$record_counter = $data['counter'];
|
|
|
|
}
|
|
|
|
$req = $db->prepare('SELECT COUNT(*) AS counter FROM `authors`');
|
|
|
|
$req->execute();
|
|
|
|
|
|
|
|
if ($data = $req->fetch()) {
|
|
|
|
$user_counter = $data['counter'];
|
|
|
|
}
|
|
|
|
$req = $db->prepare('SELECT COUNT(*) AS counter FROM `taxa`');
|
|
|
|
$req->execute();
|
|
|
|
|
|
|
|
if ($data = $req->fetch()) {
|
|
|
|
$taxa_counter = $data['counter'];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div id="status">
|
|
|
|
<?=$record_counter?> Records Uploaded<br>
|
|
|
|
<?=$user_counter?> Users Registered<br>
|
|
|
|
<?=$taxa_counter?> Taxa Available<br>
|
2021-04-15 12:29:53 +02:00
|
|
|
|
|
|
|
<?php
|
|
|
|
$bytes = disk_free_space ("$root/storage/records");
|
|
|
|
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
|
|
|
|
$base = 1024;
|
|
|
|
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
|
|
|
|
echo sprintf('%1.2f', $bytes / pow($base,$class)).' '.$si_prefix[$class];?> of Free space <br>
|
2021-04-01 11:40:36 +02:00
|
|
|
</div>
|