Merge pull request #444 from AL-Kateb/master

Prevent user from illegally founding a new village with 0 settlers
This commit is contained in:
Martin Ambrus
2018-01-01 21:51:12 +01:00
committed by GitHub
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 ) );
+19 -2
View File
@@ -32,6 +32,17 @@ $time = round($time);
}
}
}
//-- 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;
}
//--
echo '<pre>';
echo '</pre>';
?>
@@ -59,8 +70,14 @@ echo '</pre>';
<th>Troops</th>
<?php for($i=1;$i<=9;$i++) {
echo "<td class=\"none\">0</td>";
} ?>
<td>3</td>
}
if($settlers >= 3){
echo "<td>3</td>";
}else{
echo "<td class=\"none\">0</td>";
}
?>
</tr>
</tbody>
<tbody class="infos">