prepare(" INSERT INTO activity_log (user_id, action, description, ip_address, user_agent, created_at) VALUES (?, 'logout', 'Utente ha effettuato il logout', ?, ?, NOW()) "); $stmt->execute([ $_SESSION['user_id'], $_SERVER['REMOTE_ADDR'] ?? null, $_SERVER['HTTP_USER_AGENT'] ?? null ]); } // Effettua il logout logout_user(); // Reindirizza alla home header('Location: ../index.php'); exit; ?>