Willkommen statistik
This commit is contained in:
parent
fc17a1a312
commit
ba9ec6b430
@ -130,6 +130,19 @@ class NotesModel extends Database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNoteCount() {
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
if (!$pdo) return 0;
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("SELECT COUNT(*) FROM notes");
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetchColumn();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log("Get Notes Count Error: " . $e->getMessage());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isLoggedIn() {
|
function isLoggedIn() {
|
||||||
return isset($_SESSION['user_id']);
|
return isset($_SESSION['user_id']);
|
||||||
}
|
}
|
||||||
|
@ -69,4 +69,17 @@ class UserModel extends Database
|
|||||||
return ['success' => false, 'message' => 'An error occurred during registration.'];
|
return ['success' => false, 'message' => 'An error occurred during registration.'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUserCount() {
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
if (!$pdo) return 0;
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("SELECT COUNT(*) FROM users");
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetchColumn();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log("Get User Count Error: " . $e->getMessage());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,32 @@
|
|||||||
<?php include dirname(__DIR__).'/header.phtml'; ?>
|
<?php
|
||||||
|
use ppa\Model\NotesModel;
|
||||||
|
include dirname(__DIR__).'/header.phtml';
|
||||||
|
|
||||||
<h2>Baustelle</h2>
|
$parsedown = new Parsedown();
|
||||||
|
$parsedown->setSafeMode(true);
|
||||||
|
|
||||||
|
$this->notesModel = new \ppa\Model\NotesModel();
|
||||||
|
$this->userModel = new \ppa\Model\UserModel();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h2>Willkommen in der Notiz App!</h2>
|
||||||
|
|
||||||
|
<p>Um loszulegen, wählen Sie bitte eine Option aus der Navigation.</p>
|
||||||
|
|
||||||
|
<h2>Notiz App Statistiken</h2>
|
||||||
|
<b style="font-size: 20px; margin: 20px">
|
||||||
|
<?php
|
||||||
|
echo $this->notesModel->getNoteCount();
|
||||||
|
?>
|
||||||
|
Notizen
|
||||||
|
</b><br>
|
||||||
|
|
||||||
|
<b style="font-size: 20px; margin: 20px">
|
||||||
|
<?php
|
||||||
|
echo $this->userModel->getUserCount();
|
||||||
|
?>
|
||||||
|
Benutzer
|
||||||
|
</b>
|
||||||
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user