mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-02 08:27:15 +00:00
Merge pull request #444 from AL-Kateb/master
Prevent user from illegally founding a new village with 0 settlers
This commit is contained in:
+11
-1
@@ -727,7 +727,17 @@ class Units {
|
|||||||
|
|
||||||
public function Settlers($post) {
|
public function Settlers($post) {
|
||||||
global $form, $database, $village, $session;
|
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 ) {
|
if ( $session->access != BANNED ) {
|
||||||
$mode = CP;
|
$mode = CP;
|
||||||
$total = count( $database->getProfileVillages( $session->uid ) );
|
$total = count( $database->getProfileVillages( $session->uid ) );
|
||||||
|
|||||||
@@ -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>';
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
?>
|
?>
|
||||||
@@ -59,8 +70,14 @@ echo '</pre>';
|
|||||||
<th>Troops</th>
|
<th>Troops</th>
|
||||||
<?php for($i=1;$i<=9;$i++) {
|
<?php for($i=1;$i<=9;$i++) {
|
||||||
echo "<td class=\"none\">0</td>";
|
echo "<td class=\"none\">0</td>";
|
||||||
} ?>
|
}
|
||||||
<td>3</td>
|
|
||||||
|
if($settlers >= 3){
|
||||||
|
echo "<td>3</td>";
|
||||||
|
}else{
|
||||||
|
echo "<td class=\"none\">0</td>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody class="infos">
|
<tbody class="infos">
|
||||||
|
|||||||
Reference in New Issue
Block a user