This commit is contained in:
Bashy 2026-05-03 20:56:15 +03:00
commit 60ca58f5ba
80 changed files with 9458 additions and 0 deletions

9
lib/Audit.php Normal file
View file

@ -0,0 +1,9 @@
<?php
class Audit {
public static function log(PDO $db, string $action, ?int $project_id = null, ?string $detail = null): void {
try {
$db->prepare('INSERT INTO audit_log (user_id, project_id, action, detail, ip) VALUES (?, ?, ?, ?, ?)')
->execute([$_SESSION['user_id'] ?? null, $project_id, $action, $detail, $_SERVER['REMOTE_ADDR'] ?? null]);
} catch (Exception $e) { /* don't let audit failures break the main op */ }
}
}