Farm list fixes

+Fixed a bug that permitted to attack the same village where the
farmlist was created
This commit is contained in:
iopietro
2018-05-16 17:36:29 +02:00
parent bdd3bfd41c
commit f156c6bc80
3 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ if(!$database->getVilFarmlist($session->uid)){
exit;
}
if(isset($_POST['action']) && $_POST['action'] == 'addSlot' && isset($_POST['lid']) && $database->getFLData($_POST['lid'])['owner'] == $session->uid) {
if(isset($_POST['action']) && $_POST['action'] == 'addSlot' && isset($_POST['lid']) && ($FLData = $database->getFLData($_POST['lid']))['owner'] == $session->uid) {
$troops = 0;
for($i = 1; $i <= 6; $i++){
@@ -34,7 +34,7 @@ if(isset($_POST['action']) && $_POST['action'] == 'addSlot' && isset($_POST['lid
elseif($oasistype == 0 && $vdata == 0) $errormsg = "There is no village on those coordinates.";
elseif($troops == 0) $errormsg = "No troops has been selected.";
elseif($database->hasBeginnerProtection($Wref) == 1) $errormsg = "Player under protection.";
elseif($_POST['target_id'] == $village->wid || $vdata['wref'] == $village->wid) $errormsg = "You can't attack the same village you send troops from.";
elseif($_POST['target_id'] == $FLData['wref'] || $vdata['wref'] == $FLData['wref']) $errormsg = "You can't attack the same village you're sending troops from.";
else
{
if(!empty($_POST['target_id'])){
+4 -2
View File
@@ -14,7 +14,9 @@ if(isset($_GET['action']) == 'editSlot' && $_GET['eid']) {
}
if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET['eid']) && isset($_POST['lid']) && !empty($_POST['lid'])) {
if(!empty($_POST['target_id'])){
$FLData = $database->getFLData($_POST['lid']);
if(!empty($_POST['target_id'])){
$Wref = $_POST['target_id'];
$WrefCoor = $database->getCoor($Wref);
$WrefX = $WrefCoor['x'];
@@ -41,7 +43,7 @@ if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET[
elseif($oasistype == 0 && $vdata == 0) $errormsg = "There is no village on those coordinates.";
elseif($troops == 0) $errormsg = "No troops has been selected.";
elseif($database->hasBeginnerProtection($Wref) == 1) $errormsg = "Player under protection.";
elseif($_POST['target_id'] == $village->wid || $vdata['wref'] == $village->wid) $errormsg = "You can't attack the same village you send troops from.";
elseif($_POST['target_id'] == $FLData['wref'] || $vdata['wref'] == $FLData['wref']) $errormsg = "You can't attack the same village you're sending troops from.";
else
{
if(!empty($_POST['target_id'])){
+1 -1
View File
@@ -1,6 +1,6 @@
- shouldn't we create accounts from middle towards corners, not middle-corners-everywhere?
+ change "incoming attacker" title of the raid list icon when actually attacking a farm (it should be "Own attacking troops")
- change "select all" button to actually select all checkboxes via JS, not via page reload
+ change "select all" button to actually select all checkboxes via JS, not via page reload
- make sure that when auto-removing inactive players, anyone who have units going there + anyone with them in their raid lists etc. gets notified and sorted out
- display "send troops" link for own villages, so we don't have to enter coordinates or search by name (which can search good name but wrong owner!)
- check the following queries for performing stuff on DB rather than in PHP: