fix: undefined indexes

This commit is contained in:
Martin Ambrus
2017-11-01 21:35:24 +01:00
parent 396250f393
commit 041726fbd2
6 changed files with 22 additions and 15 deletions
+8 -8
View File
@@ -21,16 +21,16 @@
<tr class="slr3">
<td>
<select name="p" size="1" class="slr3">
<option value="player" <?php if($_POST['p']=='player'){echo "selected";}?>>Search Players</option>
<option value="alliances" <?php if($_POST['p']=='alliances'){echo "selected";}?>>Search Alliances</option>
<option value="villages" <?php if($_POST['p']=='villages'){echo "selected";}?>>Search Villages</option>
<option value="email" <?php if($_POST['p']=='email'){echo "selected";}?>>Search E-mails</option>
<option value="ip" <?php if($_POST['p']=='ip'){echo "selected";}?>>Search IPs</option>
<option value="deleted_players" <?php if($_POST['p']=='deleted_players'){echo "selected";}?>>Search Deleted Players</option>
<option value="player" <?php if(isset($_POST['p']) && $_POST['p']=='player'){echo "selected";}?>>Search Players</option>
<option value="alliances" <?php if(isset($_POST['p']) && $_POST['p']=='alliances'){echo "selected";}?>>Search Alliances</option>
<option value="villages" <?php if(isset($_POST['p']) && $_POST['p']=='villages'){echo "selected";}?>>Search Villages</option>
<option value="email" <?php if(isset($_POST['p']) && $_POST['p']=='email'){echo "selected";}?>>Search E-mails</option>
<option value="ip" <?php if(isset($_POST['p']) && $_POST['p']=='ip'){echo "selected";}?>>Search IPs</option>
<option value="deleted_players" <?php if(isset($_POST['p']) && $_POST['p']=='deleted_players'){echo "selected";}?>>Search Deleted Players</option>
</select>
</td>
<td>
<input name="s" value="<?php echo stripslashes(stripslashes($_POST['s']));?>">
<input name="s" value="<?php echo stripslashes((isset($_POST['p']) ? $_POST['s'] : ''));?>">
</td>
<td>
<input type="submit" value="Search" class="slr3">
@@ -40,7 +40,7 @@
</form>
<?php
if($_GET['msg'])
if(!empty($_GET['msg']))
{
echo '<div style="margin-top: 50px;" class="b"><center>';
if($_GET['msg'] == 'ursdel')
+1 -1
View File
@@ -468,7 +468,7 @@ class Battle {
// Formula for calculating points attackers (Infantry & Cavalry)
if($AttackerWref != 0){
$rap = ($ap+$cap)+(($ap+$cap)/100*$bid35[$this->getTypeLevel(35,$AttackerWref)]['attri']);
$rap = ($ap+$cap)+(($ap+$cap)/100*(isset($bid35[$this->getTypeLevel(35,$AttackerWref)]) ? $bid35[$this->getTypeLevel(35,$AttackerWref)]['attri'] : 0));
}else{
$rap = $ap+$cap;
}
+8 -1
View File
@@ -285,7 +285,14 @@ class Technology {
$movement = $database->getVillageMovement($base);
if(!empty($movement)) {
for($i=1;$i<=50;$i++) {
$ownunit['u'.$i] += $movement['u'.$i];
if (!isset($ownunit['u'.$i])) {
$ownunit['u'.$i] = 0;
}
$ownunit['u'.$i] += (isset($movement['u'.$i]) ? $movement['u'.$i] : 0);
}
if (!isset($ownunit['hero'])) {
$ownunit['hero'] = 0;
}
$ownunit['hero'] += $movement['hero'];
}
+3 -4
View File
@@ -129,7 +129,7 @@ class Units {
$form->addError("error","You need to mark min. one troop");
}
if(!$post['dname'] && !$post['x'] && !$post['y']){
if(!empty($post['dname']) && !empty($post['x']) && !empty($post['y'])){
$form->addError("error","Insert name or coordinates");
}
@@ -174,7 +174,7 @@ class Units {
}
}
}
if ($database->isVillageOases($id) == 0) {
if (isset($id) && $database->isVillageOases($id) == 0) {
if($database->hasBeginnerProtection($id)==1) {
$form->addError("error","Player is under beginners protection. You can't attack him");
}
@@ -220,8 +220,7 @@ class Units {
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
exit;
}else{
} else if (isset($id)) {
$villageName = $database->getOasisField($id,"name");
$speed= 300;
$timetaken = $generator->procDistanceTime($coor,$village->coor,INCREASE_SPEED,1);
+1
View File
@@ -1,6 +1,7 @@
<?php
$units = $database->getMovement(3,$village->wid,0);
$total_for = count($units);
$timer = 0;
for($y=0;$y<$total_for;$y++){
$timer += 1;
+1 -1
View File
@@ -72,7 +72,7 @@ $ckey= $generator->generateRandStr(6);
(!empty($process['t10']) ? $process['t10'] : 0) +
(!empty($process['t11']) ? $process['t11'] : 0);
}
if ($scout==1 && $totalunits==0) {
if (isset($scout) && $scout==1 && isset($totalunits) && $totalunits==0) {
if ($process['c'] != 2){
$process['c'] = 1;
}