diff --git a/install/multi.php b/install/multi.php index c3a6bada..71a65ff8 100644 --- a/install/multi.php +++ b/install/multi.php @@ -73,30 +73,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['create_definitions']) if ($id === '') { $id = 's' . $i; } - if (!preg_match('/^[a-z0-9][a-z0-9_-]{0,31}$/', $id)) { $error = 'Instance ID invalid la serverul ' . $i . '. Foloseste doar litere mici, cifre, _ sau -.'; break; } - if (isset($usedIds[$id])) { $error = 'Instance ID duplicat: ' . htmlspecialchars($id, ENT_QUOTES, 'UTF-8'); break; } $usedIds[$id] = true; - - if ($name === '') { - $name = 'TravianZ ' . strtoupper($id); - } - - if ($db === '') { - $db = 'travian_' . preg_replace('/[^a-zA-Z0-9_]/', '_', $id); - } - - if ($prefix === '') { - $prefix = $id . '_'; - } - + if ($name === '') $name = 'TravianZ ' . strtoupper($id); + if ($db === '') $db = 'travian_' . preg_replace('/[^a-zA-Z0-9_]/', '_', $id); + if ($prefix === '') $prefix = $id . '_'; if (!preg_match('/^[A-Za-z0-9_$]+_$/', $prefix)) { $error = 'Prefix invalid la serverul ' . $i . '.'; break; @@ -107,11 +95,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['create_definitions']) $error = 'Nu pot crea directorul instanței ' . $id . '.'; break; } - $runtimePath = $instancePath . DIRECTORY_SEPARATOR . 'runtime'; - if (!is_dir($runtimePath)) { - @mkdir($runtimePath, 0775, true); - } + if (!is_dir($runtimePath)) @mkdir($runtimePath, 0775, true); $newRegistry[$id] = [ 'id' => $id, @@ -134,15 +119,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['create_definitions']) } } -$selected = strtolower(trim((string) ($_GET['instance'] ?? ''))); -if ($selected !== '' && !isset($registry[$selected])) { - $selected = ''; -} - $serverCount = isset($_POST['server_count']) ? max(1, min(100, (int) $_POST['server_count'])) : max(1, count($registry)); -if ($serverCount < 1) { - $serverCount = 1; -} +if ($serverCount < 1) $serverCount = 1; ?> @@ -196,12 +174,9 @@ if ($serverCount < 1) { box.appendChild(div); } } - function escapeHtml(value) { - return String(value).replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"'); - } + function escapeHtml(value) { return String(value).replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"'); } window.addEventListener('DOMContentLoaded', function(){ - const count = document.getElementById('server_count'); - if (count && !document.querySelector('#servers .server')) buildServers(); + if (!document.querySelector('#servers .server')) buildServers(); }); @@ -252,17 +227,14 @@ if ($serverCount < 1) { Status: =htmlspecialchars($instance['status'] ?? 'defined', ENT_QUOTES, 'UTF-8')?>