From 1dde2599f3cb390e19fb8129c1ca123bcf5bbd3c Mon Sep 17 00:00:00 2001 From: Catalin Novgorodschi <1140613+Shadowss@users.noreply.github.com> Date: Thu, 23 Oct 2025 09:59:39 +0300 Subject: [PATCH] fix addUsers.tpl --- Admin/Templates/addUsers.tpl | 294 +++++++++++++------------- GameEngine/Admin/Mods/addUserstpl.php | 167 --------------- 2 files changed, 148 insertions(+), 313 deletions(-) delete mode 100644 GameEngine/Admin/Mods/addUserstpl.php diff --git a/Admin/Templates/addUsers.tpl b/Admin/Templates/addUsers.tpl index c051c32d..cd7cd4b6 100644 --- a/Admin/Templates/addUsers.tpl +++ b/Admin/Templates/addUsers.tpl @@ -1,165 +1,167 @@ - -
+
Create Users and Villages

-Submitting this form will create new Users
(and their home Villages) on your server! -

with all resource, mainbuilding, rallypoint, warehouse, granary, wall, marketplaced, residence, troop (for level-up hero) and one cranny. - +Submitting this form will create new Users and/or Villages on your server! -

-Base Name should be between 4 and 20 characters long -

- How Many should be between 1 and 200
- (Higher values might take a while or cause a crash!) -

- If you want to run this more than once you should use different a different Base Name each time - if a UserName already exists it will be skipped -

- Example:
- Base Name = Farm
- How Many = 5
- Users created will be Farm1, Farm2, Farm3, Farm4, Farm5
-
-
- - + +Includes resources, main building, rally point, warehouse, granary, wall, market, residence, troops (for hero level-up), and one cranny. + +

Base Name should be between 4 and 20 characters long

+ + +Mode
+
+ +

+ + +How Many (accounts) should be between 1 and 200
+(Higher values might take a while or cause a crash!) +

+ + +If you want to run this more than once you should use a different Base Name each time.
+
+Example (legacy):
+Base Name = Farm | How Many (accounts) = 5 → Users: Farm1..Farm5
+Example (single):
+Base Name = FarmLord | Villages = 5 → User: FarmLord with 5 villages +

+ +
Error: Base Name is too short (min 4 chars)'; - break; - case 'BN2L': - $baseNameFontColor = "Red"; - echo '

Error: Base Name is too long (max 20 chars)'; - break; - case 'AMLO': - $amountFontColor = "Red"; - echo '

Error: Minimum of 1 for How Many'; - break; - case 'AMHI': - $amountFontColor = "Red"; - echo '

Error: Maximum of 200 for How Many'; - break; - default: - // Should never reach here - $baseNameFontColor = "Black"; - $amountFontColor = "Black"; - echo '

Error: Unknown'; - } + $amount = 20; // accounts (legacy) + $villages = 5; // villages (single account) + $mode = "many_accounts"; + + if(isset($_GET['e'])) { + $baseName = ($_GET['bn']); + $amount = isset($_GET['am']) ? ($_GET['am']) : $amount; + $villages = isset($_GET['vi']) ? ($_GET['vi']) : $villages; + $mode = isset($_GET['mo']) ? ($_GET['mo']) : $mode; + + switch ($_GET['e']) { + case 'BN2S': + $baseNameFontColor = "Red"; + echo '

Error: Base Name is too short (min 4 chars)'; + break; + case 'BN2L': + $baseNameFontColor = "Red"; + echo '

Error: Base Name is too long (max 20 chars)'; + break; + case 'AMLO': + $amountFontColor = "Red"; + echo '

Error: Minimum of 1 for How Many (accounts)'; + break; + case 'AMHI': + $amountFontColor = "Red"; + echo '

Error: Maximum of 200 for How Many (accounts)'; + break; + case 'VILO': + $villagesFontColor = "Red"; + echo '

Error: Minimum of 1 for Villages'; + break; + case 'VIHI': + $villagesFontColor = "Red"; + echo '

Error: Maximum of 200 for Villages'; + break; + default: + echo '

Error: Unknown'; } - elseif ( isset($_GET['g']) && $_GET['g'] == 'OK') - { - $baseName = ($_GET['bn']); - $amount = ($_GET['am']); - $skipped = ($_GET['sk']); - $beginnersProtection = ($_GET['bp']); - switch ($_GET['tr']) - { - case '0': - $tribe = RANDOM; - break; - case '1': - $tribe = TRIBE1; // Romans - break; - case '2': - $tribe = TRIBE2; // Teutons - break; - case '3': - $tribe = TRIBE3; // Gauls - break; - default: - // Should never reach here - $tribe = 'Unknown'; - } - - echo '

- ' - . $amount . - ' - Users and Villages added using Base Name - ' - . $baseName . - '
'; - - // Say if Beginners Protection was set for any Users created - if ($amount > 0) - { - // Plural or Singular for User(s) - // TODO: Add options for these to lang files - if ($amount > 1) - { - $usersMessage = 'these Users'; - } - else - { - $usersMessage = 'this User'; - } - $begMessage = 'Beginners Protection was '; - if (!$beginnersProtection) - { - $begMessage .= 'NOT '; - } - $begMessage .= 'set for ' . $usersMessage . '
'; - echo $begMessage; - - // Say Tribes chosen - $tribeMessage = 'Tribe for ' . $usersMessage . ' was '; - $tribeMessage .= $tribe . '
'; - echo $tribeMessage; - } - if ($skipped > 0) - { - echo '' - . $skipped . - ' - Users not created as the user name already exists -
'; - } - echo '
Now would be a good time to ' - . 'Return to the server' - . ' this will update rankings etc but will take a while!
' - . ' Make sure max_execution_time is set to a high enough value in php.ini

' - . 'Choose a different Base Name if you want to create more
'; - // Clear the basename from form values so not used again - $baseName = ""; - $amount = ""; + } + elseif ( isset($_GET['g']) && $_GET['g'] == 'OK') { + $baseName = ($_GET['bn']); + $mode = ($_GET['mo']); + $skipped = ($_GET['sk']); + $beginnersProtection = ($_GET['bp']); + + // interpret the tribe label + switch ($_GET['tr']) { + case '0': $tribe = RANDOM; break; + case '1': $tribe = TRIBE1; break; + case '2': $tribe = TRIBE2; break; + case '3': $tribe = TRIBE3; break; + default: $tribe = 'Unknown'; } - ?> -
+ + if ($mode === 'many_accounts') { + $amount = ($_GET['am']); + echo '

'.$amount.' Users (1 village each) added with Base Name '.$baseName.'
'; + } else { + $villages = ($_GET['vi']); + echo '

Created User '.$baseName.' with '.$villages.' villages.
'; + } + + if (($mode === 'many_accounts' && $amount > 0) || ($mode === 'single_with_villages' && $villages > 0)) { + $usersMessage = ($mode === 'many_accounts' ? (($amount > 1) ? 'these Users' : 'this User') : 'this User'); + $begMessage = 'Beginners Protection was '; + if (!$beginnersProtection) { $begMessage .= 'NOT '; } + $begMessage .= 'set for '.$usersMessage.'
'; + echo $begMessage; + + $tribeMessage = 'Tribe for '.$usersMessage.' was '.$tribe.'
'; + echo $tribeMessage; + } + + if ($skipped > 0) { + echo ''.$skipped.' Users not created as the user name already exists
'; + } + + echo '
Now would be a good time to Return to the server (updates rankings; may take a while)
' + . 'Make sure max_execution_time is set high enough in php.ini

'; + $baseName = ""; $amount = ""; $villages = ""; + } +?> +
-Base Name   -

-How Many    + + +Base Name   +

+ + +
+How Many (accounts)    + +
+ + +
+Villages (for single account)    + +
+ +
Beginners Protection   

Tribe:

-
-
-
+
+
+


- + + +
diff --git a/GameEngine/Admin/Mods/addUserstpl.php b/GameEngine/Admin/Mods/addUserstpl.php deleted file mode 100644 index cd7cd4b6..00000000 --- a/GameEngine/Admin/Mods/addUserstpl.php +++ /dev/null @@ -1,167 +0,0 @@ -
- - -
Create Users and Villages -

- -Submitting this form will create new Users and/or Villages on your server! - -
- -Includes resources, main building, rally point, warehouse, granary, wall, market, residence, troops (for hero level-up), and one cranny. - -

Base Name should be between 4 and 20 characters long

- - -Mode
-
- -

- - -How Many (accounts) should be between 1 and 200
-(Higher values might take a while or cause a crash!) -

- - -If you want to run this more than once you should use a different Base Name each time.
-
-Example (legacy):
-Base Name = Farm | How Many (accounts) = 5 → Users: Farm1..Farm5
-Example (single):
-Base Name = FarmLord | Villages = 5 → User: FarmLord with 5 villages -

- -
Error: Base Name is too short (min 4 chars)'; - break; - case 'BN2L': - $baseNameFontColor = "Red"; - echo '

Error: Base Name is too long (max 20 chars)'; - break; - case 'AMLO': - $amountFontColor = "Red"; - echo '

Error: Minimum of 1 for How Many (accounts)'; - break; - case 'AMHI': - $amountFontColor = "Red"; - echo '

Error: Maximum of 200 for How Many (accounts)'; - break; - case 'VILO': - $villagesFontColor = "Red"; - echo '

Error: Minimum of 1 for Villages'; - break; - case 'VIHI': - $villagesFontColor = "Red"; - echo '

Error: Maximum of 200 for Villages'; - break; - default: - echo '

Error: Unknown'; - } - } - elseif ( isset($_GET['g']) && $_GET['g'] == 'OK') { - $baseName = ($_GET['bn']); - $mode = ($_GET['mo']); - $skipped = ($_GET['sk']); - $beginnersProtection = ($_GET['bp']); - - // interpret the tribe label - switch ($_GET['tr']) { - case '0': $tribe = RANDOM; break; - case '1': $tribe = TRIBE1; break; - case '2': $tribe = TRIBE2; break; - case '3': $tribe = TRIBE3; break; - default: $tribe = 'Unknown'; - } - - if ($mode === 'many_accounts') { - $amount = ($_GET['am']); - echo '

'.$amount.' Users (1 village each) added with Base Name '.$baseName.'
'; - } else { - $villages = ($_GET['vi']); - echo '

Created User '.$baseName.' with '.$villages.' villages.
'; - } - - if (($mode === 'many_accounts' && $amount > 0) || ($mode === 'single_with_villages' && $villages > 0)) { - $usersMessage = ($mode === 'many_accounts' ? (($amount > 1) ? 'these Users' : 'this User') : 'this User'); - $begMessage = 'Beginners Protection was '; - if (!$beginnersProtection) { $begMessage .= 'NOT '; } - $begMessage .= 'set for '.$usersMessage.'
'; - echo $begMessage; - - $tribeMessage = 'Tribe for '.$usersMessage.' was '.$tribe.'
'; - echo $tribeMessage; - } - - if ($skipped > 0) { - echo ''.$skipped.' Users not created as the user name already exists
'; - } - - echo '
Now would be a good time to Return to the server (updates rankings; may take a while)
' - . 'Make sure max_execution_time is set high enough in php.ini

'; - $baseName = ""; $amount = ""; $villages = ""; - } -?> -
-
- - -Base Name   - -

- - -
-How Many (accounts)    - -
- - -
-Villages (for single account)    - -
- -
-Beginners Protection    -

-Tribe:
-
-
-
-
-

- - - -