fix path for cybersecurity issues

fix path in admin.php & add to config.php mdp to connect to panel admin ( config.php is not commited )
This commit is contained in:
2026-05-18 00:37:51 +02:00
parent 30b858649a
commit 2d4f609562
2 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -2,9 +2,11 @@
/* --- SESSION & AUTHENTICATION --- */ /* --- SESSION & AUTHENTICATION --- */
session_start(); session_start();
$config = require_once './config.php';
$error = ''; $error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'login') { if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'login') {
if ($_POST['username'] === 'admin' && $_POST['password'] === 'admin') { if ($_POST['username'] === $config['admin_user'] && $_POST['password'] === $config['admin_pass']) {
$_SESSION['admin_logged_in'] = true; $_SESSION['admin_logged_in'] = true;
header('Location: admin.php'); header('Location: admin.php');
exit; exit;
@@ -20,10 +22,10 @@ if (isset($_GET['logout'])) {
} }
/* --- DATABASE CONFIGURATION --- */ /* --- DATABASE CONFIGURATION --- */
$host = 'mysql-openplanetsmaps.alwaysdata.net'; $host = $config['host'];
$dbname = 'openplanetsmaps_bdd'; $dbname = $config['dbname'];
$db_user = 'openplanetsmaps_root'; $db_user = $config['username'];
$db_pass = 'ka041006'; $db_pass = $config['password'];
$message = ''; $message = '';
/* --- FORM PROCESSING & DB INSERTION --- */ /* --- FORM PROCESSING & DB INSERTION --- */
+1 -1
View File
@@ -2,7 +2,7 @@
header('Content-Type: application/json'); header('Content-Type: application/json');
/* --- CONFIGURATION & SETUP --- */ /* --- CONFIGURATION & SETUP --- */
$config = require_once __DIR__ . '/config.php'; $config = require_once 'config.php';
$host = $config['host']; $host = $config['host'];
$dbname = $config['dbname']; $dbname = $config['dbname'];
$username = $config['username']; $username = $config['username'];