mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-26 21:27:15 +00:00
Add checkbox for Beginner's Protection when creating Users in Admin Panel
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
$baseName = ($_GET['bn']);
|
$baseName = ($_GET['bn']);
|
||||||
$amount = ($_GET['am']);
|
$amount = ($_GET['am']);
|
||||||
$skipped = ($_GET['sk']);
|
$skipped = ($_GET['sk']);
|
||||||
|
$beginnersProtection = ($_GET['bp']);
|
||||||
echo '<br /><br />
|
echo '<br /><br />
|
||||||
<font color="Blue"><b>'
|
<font color="Blue"><b>'
|
||||||
. $amount .
|
. $amount .
|
||||||
@@ -82,6 +83,28 @@
|
|||||||
<font color="Blue"><b>'
|
<font color="Blue"><b>'
|
||||||
. $baseName .
|
. $baseName .
|
||||||
'</b></font><br>';
|
'</b></font><br>';
|
||||||
|
|
||||||
|
// Say if Beginners Protection was set for any Users created
|
||||||
|
if ($amount > 0)
|
||||||
|
{
|
||||||
|
$begMessage = 'Beginners Protection was ';
|
||||||
|
if (!$beginnersProtection)
|
||||||
|
{
|
||||||
|
$begMessage .= 'NOT ';
|
||||||
|
}
|
||||||
|
$begMessage .= 'set for ';
|
||||||
|
if ($amount > 1)
|
||||||
|
{
|
||||||
|
$begMessage .= 'these Users';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$begMessage .= 'this User';
|
||||||
|
}
|
||||||
|
|
||||||
|
$begMessage .= '<br>';
|
||||||
|
echo $begMessage;
|
||||||
|
}
|
||||||
if ($skipped > 0)
|
if ($skipped > 0)
|
||||||
{
|
{
|
||||||
echo '<font color="Red"><b>'
|
echo '<font color="Red"><b>'
|
||||||
@@ -90,7 +113,7 @@
|
|||||||
Users not created as the user name already exists
|
Users not created as the user name already exists
|
||||||
</b></font><br>';
|
</b></font><br>';
|
||||||
}
|
}
|
||||||
echo 'Now would be a good time to '
|
echo '<br>Now would be a good time to '
|
||||||
. '<a href="' . SERVER . 'dorf1.php">Return to the server</a>'
|
. '<a href="' . SERVER . 'dorf1.php">Return to the server</a>'
|
||||||
. ' this will update rankings etc but <b>will</b> take a while!<br>'
|
. ' this will update rankings etc but <b>will</b> take a while!<br>'
|
||||||
. ' Make sure <b>max_execution_time</b> is set to a high enough value in php.ini<br><br>'
|
. ' Make sure <b>max_execution_time</b> is set to a high enough value in php.ini<br><br>'
|
||||||
@@ -101,9 +124,11 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<br>
|
<br>
|
||||||
<font color ="<?php echo $baseNameFontColor ?>">Base Name </font><input name="users_base_name" id="users_name" value="<?php echo $baseName ?>" maxlength="20">
|
<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>
|
<br><br>
|
||||||
<font color ="<?php echo $amountFontColor ?>">How Many <font><input name="users_amount" id="users_amount" value="<?php echo $amount ?>" maxlength="4">
|
<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 <font><input type ="checkbox" name="users_protection" id="users_protection" checked>
|
||||||
<br><br>
|
<br><br>
|
||||||
<input type="submit" value="Create Users">
|
<input type="submit" value="Create Users">
|
||||||
</center>
|
</center>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ mysql_select_db(SQL_DB);
|
|||||||
$id = $_POST['id'];
|
$id = $_POST['id'];
|
||||||
$baseName = $_POST['users_base_name'];
|
$baseName = $_POST['users_base_name'];
|
||||||
$amount = (int) $_POST['users_amount'];
|
$amount = (int) $_POST['users_amount'];
|
||||||
|
$beginnersProtection = $_POST['users_protection'];
|
||||||
|
|
||||||
// Some basic error checking
|
// Some basic error checking
|
||||||
if (strlen($baseName) < 4)
|
if (strlen($baseName) < 4)
|
||||||
@@ -74,8 +75,6 @@ else
|
|||||||
/*
|
/*
|
||||||
* @TODO
|
* @TODO
|
||||||
*
|
*
|
||||||
* Make beginners protection optional for Users created
|
|
||||||
*
|
|
||||||
* Allow option to create (random) bigger villages,
|
* Allow option to create (random) bigger villages,
|
||||||
* upgrade fields, granary, warehouse, wall etc
|
* upgrade fields, granary, warehouse, wall etc
|
||||||
*
|
*
|
||||||
@@ -85,12 +84,25 @@ else
|
|||||||
* where required
|
* 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
|
// Need a $database function for this
|
||||||
// (assuming we don't already have one as creating Natars also updates this way)
|
// (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";
|
$q = "UPDATE " . TB_PREFIX . "users SET desc2 = '[#0]' WHERE id = $uid";
|
||||||
mysql_query($q) or die(mysql_error());
|
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);
|
$database->updateUserField($uid,"act","",1);
|
||||||
$wid = $database->generateBase($kid,0);
|
$wid = $database->generateBase($kid,0);
|
||||||
$database->setFieldTaken($wid);
|
$database->setFieldTaken($wid);
|
||||||
@@ -108,6 +120,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");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user