Spaces:
Configuration error
Configuration error
Download includes/auth.php from brucelloyd1/lost-found-tracker-pro: direct link, hf CLI and curl.
- Browser
- Download file 694 Bytes
-
https://huggingface.co/spaces/brucelloyd1/lost-found-tracker-pro/resolve/main/includes/auth.php
- Command line
-
hf download hf://spaces/brucelloyd1/lost-found-tracker-pro/includes/auth.php
-
curl -L -o auth.php https://huggingface.co/spaces/brucelloyd1/lost-found-tracker-pro/resolve/main/includes/auth.php
694 Bytes
| ```php | |
| session_start(); | |
| function isLoggedIn() { | |
| return isset($_SESSION['user_id']) || isset($_SESSION['admin_id']); | |
| } | |
| function isAdmin() { | |
| return isset($_SESSION['admin_id']); | |
| } | |
| function isFinder() { | |
| return isset($_SESSION['user_id']) && isset($_SESSION['role']) && $_SESSION['role'] === 'finder'; | |
| } | |
| function isOwner() { | |
| return isset($_SESSION['user_id']) && isset($_SESSION['role']) && $_SESSION['role'] === 'owner'; | |
| } | |
| function redirectIfNotLoggedIn() { | |
| if (!isLoggedIn()) { | |
| header("Location: login.php"); | |
| exit(); | |
| } | |
| } | |
| function redirectIfNotAdmin() { | |
| if (!isAdmin()) { | |
| header("Location: login.php"); | |
| exit(); | |
| } | |
| } | |
| ``` |