Init
This commit is contained in:
commit
60ca58f5ba
80 changed files with 9458 additions and 0 deletions
9
lib/Audit.php
Normal file
9
lib/Audit.php
Normal 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 */ }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue