fix: fix boolean return type in totp.php, handle multi-statement sql and enable error reporting

This commit is contained in:
2026-09-08 14:03:47 +02:00
parent 36e38b4df3
commit 17b0557d1d
6 changed files with 29 additions and 8 deletions
+7 -4
View File
@@ -13,7 +13,6 @@ function start_secure_session(): void {
session_set_cookie_params([
'lifetime' => 7 * 24 * 60 * 60, // 7 dagen
'path' => '/',
'domain' => '',
'secure' => $isSecure,
'httponly' => true,
'samesite' => 'Lax'
@@ -26,9 +25,13 @@ function start_secure_session(): void {
* Controleert of er al een beheerder bestaat in MariaDB
*/
function has_admin_user(): bool {
$db = get_db_connection();
$stmt = $db->query("SELECT COUNT(*) FROM users WHERE role = 'ADMIN'");
return ((int)$stmt->fetchColumn()) > 0;
try {
$db = get_db_connection();
$stmt = $db->query("SELECT COUNT(*) FROM users WHERE role = 'ADMIN'");
return ((int)$stmt->fetchColumn()) > 0;
} catch (Throwable $e) {
return false;
}
}
/**