prepare("SELECT id FROM users WHERE id = :id AND uniqueid = :uniqueid"); $stmt->execute([ 'id' => $_SESSION['user_id'], 'uniqueid' => $_SESSION['uniqueid'], ]); return $stmt->fetch() !== false; } catch (PDOException $e) { return false; // fail safe } } function requireLogin() { if (!isAuthenticated()) { header("Location: /landing.php"); exit(); } }