mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-01 10:04:21 +00:00
Choose Tribe when creating Users in Admin panel
This commit is contained in:
@@ -75,6 +75,25 @@
|
||||
$amount = ($_GET['am']);
|
||||
$skipped = ($_GET['sk']);
|
||||
$beginnersProtection = ($_GET['bp']);
|
||||
switch ($_GET['tr'])
|
||||
{
|
||||
case '0':
|
||||
$tribe = RANDOM;
|
||||
break;
|
||||
case '1':
|
||||
$tribe = ROMANS;
|
||||
break;
|
||||
case '2':
|
||||
$tribe = TEUTONS;
|
||||
break;
|
||||
case '3':
|
||||
$tribe = GAULS;
|
||||
break;
|
||||
default:
|
||||
// Should never reach here
|
||||
$tribe = 'Unknown';
|
||||
}
|
||||
|
||||
echo '<br /><br />
|
||||
<font color="Blue"><b>'
|
||||
. $amount .
|
||||
@@ -87,23 +106,28 @@
|
||||
// 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 .= '<font color="red"><b>NOT</b></font> ';
|
||||
}
|
||||
$begMessage .= 'set for ';
|
||||
if ($amount > 1)
|
||||
{
|
||||
$begMessage .= 'these Users';
|
||||
}
|
||||
else
|
||||
{
|
||||
$begMessage .= 'this User';
|
||||
}
|
||||
|
||||
$begMessage .= '<br>';
|
||||
$begMessage .= 'set for ' . $usersMessage . '<br>';
|
||||
echo $begMessage;
|
||||
|
||||
// Say Tribes chosen
|
||||
$tribeMessage = 'Tribe for ' . $usersMessage . ' was ';
|
||||
$tribeMessage .= $tribe . '<br>';
|
||||
echo $tribeMessage;
|
||||
}
|
||||
if ($skipped > 0)
|
||||
{
|
||||
@@ -124,12 +148,18 @@
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<font color ="<?php echo $baseNameFontColor ?>">Base Name </font><input type ="text" name="users_base_name" id="users_name" value="<?php echo $baseName ?>" maxlength="20">
|
||||
<br><br>
|
||||
<font color ="<?php echo $amountFontColor ?>">How Many </font><input type ="text" name="users_amount" id="users_amount" value="<?php echo $amount ?>" maxlength="4">
|
||||
<br><br>
|
||||
Beginners Protection <input type ="checkbox" name="users_protection" id="users_protection" checked>
|
||||
<br><br>
|
||||
<input type="submit" value="Create Users">
|
||||
</center>
|
||||
<font color ="<?php echo $baseNameFontColor ?>">Base Name </font><input type ="text" name="users_base_name" id="users_name" value="<?php echo $baseName ?>" maxlength="20">
|
||||
<br><br>
|
||||
<font color ="<?php echo $amountFontColor ?>">How Many </font><input type ="text" name="users_amount" id="users_amount" value="<?php echo $amount ?>" maxlength="4">
|
||||
<br><br>
|
||||
Beginners Protection <input type ="checkbox" name="users_protection" id="users_protection" checked>
|
||||
<br><br>
|
||||
Tribe:<br>
|
||||
<label><input type="radio" name="tribe" value="0" checked> <?php echo RANDOM; ?></label><br>
|
||||
<label><input type="radio" name="tribe" value="1"> <?php echo ROMANS; ?></label><br>
|
||||
<label><input type="radio" name="tribe" value="2"> <?php echo TEUTONS; ?></label><br>
|
||||
<label><input type="radio" name="tribe" value="3"> <?php echo GAULS; ?></label><br>
|
||||
<br><br>
|
||||
<input type="submit" value="Create Users">
|
||||
</form>
|
||||
|
||||
@@ -18,6 +18,7 @@ $id = $_POST['id'];
|
||||
$baseName = $_POST['users_base_name'];
|
||||
$amount = (int) $_POST['users_amount'];
|
||||
$beginnersProtection = $_POST['users_protection'];
|
||||
$postTribe = $_POST['tribe'];
|
||||
|
||||
// Some basic error checking
|
||||
if (strlen($baseName) < 4)
|
||||
@@ -54,7 +55,16 @@ else
|
||||
//$password = $baseName . $i . 'PASS';
|
||||
|
||||
$email = $baseName . $i . '@example.com';
|
||||
$tribe = rand(1, 3);
|
||||
if ($postTribe == 0)
|
||||
{
|
||||
// Random Tribe
|
||||
$tribe = rand(1, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No error checking here but should be set to 1-3 from form
|
||||
$tribe = $postTribe;
|
||||
}
|
||||
// Create in a random quad
|
||||
$kid = rand(1,4);
|
||||
// Dont need to activate, not 100% sure we need to initialise $act
|
||||
@@ -120,6 +130,6 @@ else
|
||||
}
|
||||
}
|
||||
}
|
||||
header("Location: ../../../Admin/admin.php?p=addUsers&g=OK&bn=$baseName&am=$created&sk=$skipped&bp=$beginnersProtection");
|
||||
header("Location: ../../../Admin/admin.php?p=addUsers&g=OK&bn=$baseName&am=$created&sk=$skipped&bp=$beginnersProtection&tr=$postTribe");
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user