'
. $amount .
@@ -82,6 +102,33 @@
'
. $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 ''
@@ -90,7 +137,7 @@
Users not created as the user name already exists
';
}
- echo 'Now would be a good time to '
+ 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
'
@@ -101,10 +148,18 @@
}
?>
- Base Name
-
- How Many
-
-
+Base Name
+
+How Many
+
+Beginners Protection
+
+Tribe:
+
+
+
+
+
+
diff --git a/Admin/admin.php b/Admin/admin.php
index 659cae81..7157084d 100644
--- a/Admin/admin.php
+++ b/Admin/admin.php
@@ -15,6 +15,8 @@ include("../GameEngine/Database.php");
include("../GameEngine/Admin/database.php");
include("../GameEngine/config.php");
include("../GameEngine/Data/buidata.php");
+// TODO: Should we including Session.php here instead?
+include_once ("../GameEngine/Lang/" . LANG . ".php");
class timeFormatGenerator
{
diff --git a/GameEngine/Admin/Mods/addUsers.php b/GameEngine/Admin/Mods/addUsers.php
index bb94697b..aa50db13 100644
--- a/GameEngine/Admin/Mods/addUsers.php
+++ b/GameEngine/Admin/Mods/addUsers.php
@@ -17,6 +17,8 @@ mysql_select_db(SQL_DB);
$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)
@@ -53,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
@@ -74,8 +85,6 @@ else
/*
* @TODO
*
- * Make beginners protection optional for Users created
- *
* Allow option to create (random) bigger villages,
* upgrade fields, granary, warehouse, wall etc
*
@@ -85,11 +94,24 @@ else
* where required
*/
- // Show beginners protection in User Profile - see TODOs
+ // Show the dove in User Profile - will show this even if
+ // beginners protection is not checked
// Need a $database function for this
// (assuming we don't already have one as creating Natars also updates this way)
$q = "UPDATE " . TB_PREFIX . "users SET desc2 = '[#0]' WHERE id = $uid";
mysql_query($q) or die(mysql_error());
+
+ if (!$beginnersProtection)
+ {
+ // No beginners protection so set it to current time
+ // TODO create a $database function for this
+ // also used in editProtection.php so assuming no function
+ // already exists
+ $protection = time();
+ mysql_query("UPDATE ".TB_PREFIX."users SET
+ protect = '".$protection."'
+ WHERE id = $uid") or die(mysql_error());
+ }
$database->updateUserField($uid,"act","",1);
$wid = $database->generateBase($kid,0);
@@ -108,6 +130,6 @@ else
}
}
}
- header("Location: ../../../Admin/admin.php?p=addUsers&g=OK&bn=$baseName&am=$created&sk=$skipped");
+ header("Location: ../../../Admin/admin.php?p=addUsers&g=OK&bn=$baseName&am=$created&sk=$skipped&bp=$beginnersProtection&tr=$postTribe");
}
?>