Files
tor/rootfs/usr/local/share/webpanel/auth.php
casjay 57554833fd 🗃️ Committing everything that changed 🗃️
Dockerfile
README.md
rootfs/tmp/etc/nginx/nginx.conf
rootfs/tmp/etc/nginx/vhosts.d/admin.conf
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/etc/docker/init.d/99-php-fpm.sh
rootfs/usr/local/share/
2025-09-20 04:02:09 -04:00

32 lines
656 B
PHP

<?php
session_start();
$admin_user = $_ENV['TOR_ADMIN_USER'] ?? 'admin';
$admin_pass = $_ENV['TOR_ADMIN_PASS'] ?? 'torpass123';
function isAuthenticated() {
return isset($_SESSION['authenticated']) && $_SESSION['authenticated'] === true;
}
function authenticate($username, $password) {
global $admin_user, $admin_pass;
return $username === $admin_user && $password === $admin_pass;
}
function requireAuth() {
if (!isAuthenticated()) {
header('Location: login.php');
exit;
}
}
function logout() {
session_destroy();
header('Location: login.php');
exit;
}
if (isset($_GET['logout'])) {
logout();
}
?>