mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-23 02:17:05 +08:00
fix: undefined indexes and variables
This commit is contained in:
+23
-19
@@ -3602,7 +3602,11 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
$movement = $database->getVillageMovement($base);
|
$movement = $database->getVillageMovement($base);
|
||||||
if(!empty($movement)) {
|
if(!empty($movement)) {
|
||||||
for($i=1;$i<=50;$i++) {
|
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);
|
$prisoners = $database->getPrisoners($base,1);
|
||||||
@@ -4184,24 +4188,24 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
{
|
{
|
||||||
if ($row['f' . $i . 't'] == 10)
|
if ($row['f' . $i . 't'] == 10)
|
||||||
{
|
{
|
||||||
$ress += $bid10[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER;
|
$ress += ((isset($bid10[$row['f' . $i]]) && isset($bid10[$row['f' . $i]]['attri'])) ? $bid10[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['f' . $i . 't'] == 38)
|
if ($row['f' . $i . 't'] == 38)
|
||||||
{
|
{
|
||||||
$ress += $bid38[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER;
|
$ress += ((isset($bid38[$row['f' . $i]]) && isset($bid38[$row['f' . $i]]['attri'])) ? $bid38[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($row['f' . $i . 't'] == 11)
|
if ($row['f' . $i . 't'] == 11)
|
||||||
{
|
{
|
||||||
$crop += $bid11[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER;
|
$crop += ((isset($bid11[$row['f' . $i]]) && isset($bid11[$row['f' . $i]]['attri'])) ? $bid11[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['f' . $i . 't'] == 39)
|
if ($row['f' . $i . 't'] == 39)
|
||||||
{
|
{
|
||||||
$crop += $bid39[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER;
|
$crop += ((isset($bid39[$row['f' . $i]]) && isset($bid39[$row['f' . $i]]['attri'])) ? $bid39[$row['f' . $i]]['attri'] * STORAGE_MULTIPLIER : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4429,13 +4433,13 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
if(count($enforcearray)>0){
|
if(count($enforcearray)>0){
|
||||||
foreach ($enforcearray as $enforce){
|
foreach ($enforcearray as $enforce){
|
||||||
for($i = 0 ; $i <= 50 ; $i++){
|
for($i = 0 ; $i <= 50 ; $i++){
|
||||||
$units = $enforce['u'.$i];
|
$units = (isset($enforce['u'.$i]) ? $enforce['u'.$i] : 0);
|
||||||
if($enforce['u'.$i] > $maxcount){
|
if($units > $maxcount){
|
||||||
$maxcount = $enforce['u'.$i];
|
$maxcount = $units;
|
||||||
$maxtype = $i;
|
$maxtype = $i;
|
||||||
$enf = $enforce['id'];
|
$enf = $enforce['id'];
|
||||||
}
|
}
|
||||||
$totalunits += $enforce['u'.$i];
|
$totalunits += $units;
|
||||||
}
|
}
|
||||||
if($totalunits == 0){
|
if($totalunits == 0){
|
||||||
$maxcount = $enforce['hero'];
|
$maxcount = $enforce['hero'];
|
||||||
@@ -4449,13 +4453,13 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
if(count($enforcearray)>0){
|
if(count($enforcearray)>0){
|
||||||
foreach ($enforcearray as $enforce){
|
foreach ($enforcearray as $enforce){
|
||||||
for($i = 0 ; $i <= 50 ; $i++){
|
for($i = 0 ; $i <= 50 ; $i++){
|
||||||
$units = $enforce['u'.$i];
|
$units = (isset($enforce['u'.$i]) ? $enforce['u'.$i] : 0);
|
||||||
if($enforce['u'.$i] > $maxcount){
|
if($units > $maxcount){
|
||||||
$maxcount = $enforce['u'.$i];
|
$maxcount = $units;
|
||||||
$maxtype = $i;
|
$maxtype = $i;
|
||||||
$enf = $enforce['id'];
|
$enf = $enforce['id'];
|
||||||
}
|
}
|
||||||
$totalunits += $enforce['u'.$i];
|
$totalunits += $units;
|
||||||
}
|
}
|
||||||
if($totalunits == 0){
|
if($totalunits == 0){
|
||||||
$maxcount = $enforce['hero'];
|
$maxcount = $enforce['hero'];
|
||||||
@@ -4466,12 +4470,12 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
//get own unit
|
//get own unit
|
||||||
$unitarray = $database->getUnit($starv['wref']);
|
$unitarray = $database->getUnit($starv['wref']);
|
||||||
for($i = 0 ; $i <= 50 ; $i++){
|
for($i = 0 ; $i <= 50 ; $i++){
|
||||||
$units = $unitarray['u'.$i];
|
$units = (isset($unitarray['u'.$i]) ? $unitarray['u'.$i] : 0);
|
||||||
if($unitarray['u'.$i] > $maxcount){
|
if($units > $maxcount){
|
||||||
$maxcount = $unitarray['u'.$i];
|
$maxcount = $units;
|
||||||
$maxtype = $i;
|
$maxtype = $i;
|
||||||
}
|
}
|
||||||
$totalunits += $unitarray['u'.$i];
|
$totalunits += $units;
|
||||||
}
|
}
|
||||||
if($totalunits == 0){
|
if($totalunits == 0){
|
||||||
$maxcount = $unitarray['hero'];
|
$maxcount = $unitarray['hero'];
|
||||||
@@ -4502,9 +4506,9 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($difcrop > 0){
|
if($difcrop > 0){
|
||||||
global ${u.$maxtype};
|
global ${'u'.$maxtype};
|
||||||
$hungry=array();
|
$hungry=array();
|
||||||
$hungry=${u.$maxtype};
|
$hungry=${'u'.$maxtype};
|
||||||
if ($hungry['crop']>0 && $oldcrop <=0) {
|
if ($hungry['crop']>0 && $oldcrop <=0) {
|
||||||
$killunits = intval($difcrop/$hungry['crop']);
|
$killunits = intval($difcrop/$hungry['crop']);
|
||||||
}else $killunits=0;
|
}else $killunits=0;
|
||||||
|
|||||||
@@ -3577,8 +3577,15 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
foreach($returningarray as $ret) {
|
foreach($returningarray as $ret) {
|
||||||
if($ret['attack_type'] != 1) {
|
if($ret['attack_type'] != 1) {
|
||||||
for($i = 1; $i <= 10; $i++) {
|
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];
|
$movingunits['u' . (($vtribe - 1) * 10 + $i)] += $ret['t' . $i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($movingunits['hero'])) {
|
||||||
|
$movingunits['hero'] = 0;
|
||||||
|
}
|
||||||
$movingunits['hero'] += $ret['t11'];
|
$movingunits['hero'] += $ret['t11'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8") . "";
|
$users = "SELECT * FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8") . "";
|
||||||
$users2 = mysqli_num_rows(mysqli_query($GLOBALS['link'],$users));
|
$users2 = mysqli_num_rows(mysqli_query($GLOBALS['link'],$users));
|
||||||
$users3 = $users2+1;
|
$users3 = $users2+1;
|
||||||
|
$myrank = 0;
|
||||||
if(count($ranking) > 0) {
|
if(count($ranking) > 0) {
|
||||||
for($i=0;$i<($users3);$i++) {
|
for($i=0;$i<($users3);$i++) {
|
||||||
if( isset( $ranking[$i]['userid'] ) ) {
|
if( isset( $ranking[$i]['userid'] ) ) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
| <a href="spieler.php?s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) { echo "class=\"selected\""; } ?>>Preferences</a>
|
| <a href="spieler.php?s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) { echo "class=\"selected\""; } ?>>Preferences</a>
|
||||||
| <a href="spieler.php?s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) { echo "class=\"selected\""; } ?>>Account</a>
|
| <a href="spieler.php?s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) { echo "class=\"selected\""; } ?>>Account</a>
|
||||||
<?php
|
<?php
|
||||||
if($displayarray['username'] == "Shadow"){
|
if(isset($displayarray) && $displayarray['username'] == "Shadow"){
|
||||||
?>
|
?>
|
||||||
| <a href="spieler.php?s=5" <?php if(isset($_GET['s']) && $_GET['s'] == 5) { echo "class=\"selected\""; } ?>>Vacation</a>
|
| <a href="spieler.php?s=5" <?php if(isset($_GET['s']) && $_GET['s'] == 5) { echo "class=\"selected\""; } ?>>Vacation</a>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ $displayarray = $database->getUserArray($_GET['uid'],1);
|
|||||||
|
|
||||||
$varmedal = $database->getProfileMedal($_GET['uid']);
|
$varmedal = $database->getProfileMedal($_GET['uid']);
|
||||||
|
|
||||||
$profiel="".$displayarray['desc1']."".md5(skJkev3)."".$displayarray['desc2']."";
|
$profiel="".$displayarray['desc1']."".md5('skJkev3')."".$displayarray['desc2']."";
|
||||||
require("medal.php");
|
require("medal.php");
|
||||||
$profiel=explode("".md5(skJkev3)."", $profiel);
|
$profiel=explode("".md5('skJkev3')."", $profiel);
|
||||||
|
|
||||||
$varray = $database->getProfileVillages($_GET['uid']);
|
$varray = $database->getProfileVillages($_GET['uid']);
|
||||||
$totalpop = 0;
|
$totalpop = 0;
|
||||||
|
|||||||
+1
-1
@@ -98,6 +98,6 @@ class User {
|
|||||||
// convert result into an array
|
// convert result into an array
|
||||||
$res = mysqli_fetch_array($res, MYSQLI_NUM);
|
$res = mysqli_fetch_array($res, MYSQLI_NUM);
|
||||||
|
|
||||||
return ($res[0] > 0 || $res[1] > 0);
|
return ($res[0] > 0 || (count($res) > 1 && $res[1] > 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user