Prevent user from illegally founding a new village with 0 settlers

This commit is contained in:
AL-Kateb
2018-01-01 19:02:25 +00:00
parent 0f2847a533
commit caf9112314
2 changed files with 30 additions and 3 deletions
+11 -1
View File
@@ -727,7 +727,17 @@ class Units {
public function Settlers($post) {
global $form, $database, $village, $session;
//-- Prevent user from founding a new village if there are not enough settlers
//-- fix by AL-Kateb
$tempunits = $database->getUnit($village->coor['id']);
$settler_key = "u" . $session->userinfo['tribe'] . "0";
$settlers = (int)$tempunits[$settler_key];
if($settlers < 3){
header("location: dorf1.php");
exit;
}
//--
if ( $session->access != BANNED ) {
$mode = CP;
$total = count( $database->getProfileVillages( $session->uid ) );