Add new setting/configurable: site_url, prevents domain spoofing

This commit is contained in:
slawkens
2025-05-29 09:27:29 +02:00
parent 52109f5cca
commit d8a6090be3
8 changed files with 67 additions and 29 deletions

19
system/base.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
$baseDir = '';
$tmp = explode('/', $_SERVER['SCRIPT_NAME']);
$size = count($tmp) - 1;
for($i = 1; $i < $size; $i++)
$baseDir .= '/' . $tmp[$i];
$baseDir = str_replace(['/' . ADMIN_PANEL_FOLDER, '/install', '/tools'], '', $baseDir);
if (isset($_SERVER['HTTP_HOST'][0])) {
$baseHost = $_SERVER['HTTP_HOST'];
} else {
if (isset($_SERVER['SERVER_NAME'][0])) {
$baseHost = $_SERVER['SERVER_NAME'];
} else {
$baseHost = $_SERVER['SERVER_ADDR'];
}
}