Initial commit - Last War messaging system

This commit is contained in:
2026-02-19 01:33:28 -06:00
commit 38a8447a64
2162 changed files with 216183 additions and 0 deletions

31
includes/activity_logger.php Executable file
View File

@@ -0,0 +1,31 @@
<?php
function logActivity(int $userId, string $action, string $details): void
{
$pdo = getDbConnection();
$username = $_SESSION['username'] ?? 'system';
$stmt = $pdo->prepare("INSERT INTO activity_log (user_id, username, action, details, timestamp) VALUES (?, ?, ?, ?, NOW())");
$stmt->execute([$userId, $username, $action, $details]);
}
function getActivityLog(?int $limit = 100): array
{
$pdo = getDbConnection();
$stmt = $pdo->prepare("SELECT * FROM activity_log ORDER BY timestamp DESC LIMIT ?");
$stmt->execute([$limit]);
return $stmt->fetchAll();
}
function getUserActivity(int $userId, ?int $limit = 50): array
{
$pdo = getDbConnection();
$stmt = $pdo->prepare("SELECT * FROM activity_log WHERE user_id = ? ORDER BY timestamp DESC LIMIT ?");
$stmt->execute([$userId, $limit]);
return $stmt->fetchAll();
}