38 lines
945 B
PHP
38 lines
945 B
PHP
|
<?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>
|
||
|
</div>
|