Initial commit with updated Auth and media ignored

This commit is contained in:
Hamza-Ayed
2026-04-28 13:04:27 +03:00
commit 67af97474c
477 changed files with 66444 additions and 0 deletions

23
logout.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
// logout.php — تسجيل الخروج الآمن وإلغاء التوكن
require_once __DIR__ . '/connect.php';
try {
$jwtService = new JwtService($redis);
$decoded = $jwtService->authenticate();
$jti = $decoded->jti ?? null;
$exp = $decoded->exp ?? 0;
$remaining = $exp - time();
if ($jti && $remaining > 0) {
$jwtService->revokeToken($jti, $remaining);
securityLog("User logged out and token revoked", ['user_id' => $decoded->user_id, 'jti' => $jti]);
}
jsonSuccess(null, "Logged out successfully");
} catch (Exception $e) {
jsonError("Logout failed", 500);
}