diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php
index 679ae102..619132fb 100755
--- a/GameEngine/Automation.php
+++ b/GameEngine/Automation.php
@@ -3602,7 +3602,11 @@ $wallimg = "
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);
}
}
$prisoners = $database->getPrisoners($base,1);
@@ -4184,24 +4188,24 @@ $wallimg = "
0){
foreach ($enforcearray as $enforce){
for($i = 0 ; $i <= 50 ; $i++){
- $units = $enforce['u'.$i];
- if($enforce['u'.$i] > $maxcount){
- $maxcount = $enforce['u'.$i];
+ $units = (isset($enforce['u'.$i]) ? $enforce['u'.$i] : 0);
+ if($units > $maxcount){
+ $maxcount = $units;
$maxtype = $i;
$enf = $enforce['id'];
}
- $totalunits += $enforce['u'.$i];
+ $totalunits += $units;
}
if($totalunits == 0){
$maxcount = $enforce['hero'];
@@ -4449,13 +4453,13 @@ $wallimg = "
0){
foreach ($enforcearray as $enforce){
for($i = 0 ; $i <= 50 ; $i++){
- $units = $enforce['u'.$i];
- if($enforce['u'.$i] > $maxcount){
- $maxcount = $enforce['u'.$i];
+ $units = (isset($enforce['u'.$i]) ? $enforce['u'.$i] : 0);
+ if($units > $maxcount){
+ $maxcount = $units;
$maxtype = $i;
$enf = $enforce['id'];
}
- $totalunits += $enforce['u'.$i];
+ $totalunits += $units;
}
if($totalunits == 0){
$maxcount = $enforce['hero'];
@@ -4466,12 +4470,12 @@ $wallimg = "
getUnit($starv['wref']);
for($i = 0 ; $i <= 50 ; $i++){
- $units = $unitarray['u'.$i];
- if($unitarray['u'.$i] > $maxcount){
- $maxcount = $unitarray['u'.$i];
+ $units = (isset($unitarray['u'.$i]) ? $unitarray['u'.$i] : 0);
+ if($units > $maxcount){
+ $maxcount = $units;
$maxtype = $i;
}
- $totalunits += $unitarray['u'.$i];
+ $totalunits += $units;
}
if($totalunits == 0){
$maxcount = $unitarray['hero'];
@@ -4502,9 +4506,9 @@ $wallimg = "
0){
- global ${u.$maxtype};
+ global ${'u'.$maxtype};
$hungry=array();
- $hungry=${u.$maxtype};
+ $hungry=${'u'.$maxtype};
if ($hungry['crop']>0 && $oldcrop <=0) {
$killunits = intval($difcrop/$hungry['crop']);
}else $killunits=0;
diff --git a/GameEngine/Database.php b/GameEngine/Database.php
index 3390ead6..8397760e 100755
--- a/GameEngine/Database.php
+++ b/GameEngine/Database.php
@@ -3577,8 +3577,15 @@ class MYSQLi_DB implements IDbConnection {
foreach($returningarray as $ret) {
if($ret['attack_type'] != 1) {
for($i = 1; $i <= 10; $i++) {
+ if (!isset($movingunits['u' . (($vtribe - 1) * 10 + $i)])) {
+ $movingunits['u' . (($vtribe - 1) * 10 + $i)] = 0;
+ }
$movingunits['u' . (($vtribe - 1) * 10 + $i)] += $ret['t' . $i];
}
+
+ if (!isset($movingunits['hero'])) {
+ $movingunits['hero'] = 0;
+ }
$movingunits['hero'] += $ret['t11'];
}
}
diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php
index 8c009671..d6d2e357 100755
--- a/GameEngine/Ranking.php
+++ b/GameEngine/Ranking.php
@@ -23,6 +23,7 @@
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8") . "";
$users2 = mysqli_num_rows(mysqli_query($GLOBALS['link'],$users));
$users3 = $users2+1;
+ $myrank = 0;
if(count($ranking) > 0) {
for($i=0;$i<($users3);$i++) {
if( isset( $ranking[$i]['userid'] ) ) {
diff --git a/Templates/Profile/menu.tpl b/Templates/Profile/menu.tpl
index f602a3c1..4e0b7225 100644
--- a/Templates/Profile/menu.tpl
+++ b/Templates/Profile/menu.tpl
@@ -4,7 +4,7 @@
| >Preferences
| >Account
| >Vacation
getUserArray($_GET['uid'],1);
$varmedal = $database->getProfileMedal($_GET['uid']);
-$profiel="".$displayarray['desc1']."".md5(skJkev3)."".$displayarray['desc2']."";
+$profiel="".$displayarray['desc1']."".md5('skJkev3')."".$displayarray['desc2']."";
require("medal.php");
-$profiel=explode("".md5(skJkev3)."", $profiel);
+$profiel=explode("".md5('skJkev3')."", $profiel);
$varray = $database->getProfileVillages($_GET['uid']);
$totalpop = 0;
diff --git a/src/Entity/User.php b/src/Entity/User.php
index 87247920..81783a7e 100644
--- a/src/Entity/User.php
+++ b/src/Entity/User.php
@@ -98,6 +98,6 @@ class User {
// convert result into an array
$res = mysqli_fetch_array($res, MYSQLI_NUM);
- return ($res[0] > 0 || $res[1] > 0);
+ return ($res[0] > 0 || (count($res) > 1 && $res[1] > 0));
}
}
\ No newline at end of file