From 16313402e6fb485e5b30bbdc5f9a518db0f79b05 Mon Sep 17 00:00:00 2001
From: unknown
addNotice($from['owner'],$to['wref'],$ownally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
$database->addNotice($to['owner'],$to['wref'],$targetally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
}
- unset($Attacker);
- unset($Defender);
- unset($enforce);
- unset($unitssend_att);
- unset($unitssend_def);
- unset($battlepart);
- unset($unitsdead_def);
- unset($dead);
- unset($steal);
- unset($from);
- unset($data);
- unset($data2);
- unset($to);
- unset($artifact);
- unset($artifactBig);
- unset($canclaim);
- unset($data_fail);
- unset($owntribe);
- unset($unitsdead_att);
- unset($herosend_def);
- unset($deadhero);
- unset($heroxp);
- unset($AttackerID);
- unset($DefenderID);
- unset($totalsend_alldef);
- unset($totaldead_att);
- unset($totaldead_def);
- unset($unitsdead_att_check);
- unset($totalattackdead);
- unset($Defender1);
- unset($enforce1);
- unset($defheroowner);
- unset($enforceowner);
- unset($defheroxp);
- unset($reinfheroxp);
- unset($AttackerWref);
- unset($DefenderWref);
- unset($troopsdead1);
- unset($troopsdead2);
- unset($troopsdead3);
- unset($troopsdead4);
- unset($troopsdead5);
- unset($troopsdead6);
- unset($troopsdead7);
- unset($troopsdead8);
- unset($troopsdead9);
- unset($troopsdead10);
- unset($troopsdead11);
+
+ #################################################
+ ################FIXED BY SONGER################
+ #################################################
+
+ ################################################################################
+ ##############ISUE: Lag, fixed3####################################################
+ #### PHP.NET manual: unset() destroy more than one variable unset($foo1, $foo2, $foo3);######
+ ################################################################################
+
+ unset(
+ $Attacker
+ ,$Defender
+ ,$enforce
+ ,$unitssend_att
+ ,$unitssend_def
+ ,$battlepart
+ ,$unitsdead_def
+ ,$dead
+ ,$steal
+ ,$from
+ ,$data
+ ,$data2
+ ,$to
+ ,$artifact
+ ,$artifactBig
+ ,$canclaim
+ ,$data_fail
+ ,$owntribe
+ ,$unitsdead_att
+ ,$herosend_def
+ ,$deadhero
+ ,$heroxp
+ ,$AttackerID
+ ,$DefenderID
+ ,$totalsend_alldef
+ ,$totaldead_att
+ ,$totaldead_def
+ ,$unitsdead_att_check
+ ,$totalattackdead
+ ,$Defender1
+ ,$enforce1
+ ,$defheroowner
+ ,$enforceowner
+ ,$defheroxp
+ ,$reinfheroxp
+ ,$AttackerWref
+ ,$DefenderWref
+ ,$troopsdead1
+ ,$troopsdead2
+ ,$troopsdead3
+ ,$troopsdead4
+ ,$troopsdead5
+ ,$troopsdead6
+ ,$troopsdead7
+ ,$troopsdead8
+ ,$troopsdead9
+ ,$troopsdead10
+ ,$troopsdead11);
+
+ #################################################
+
}
if(file_exists("GameEngine/Prevention/sendunits.txt")) {
- @unlink("GameEngine/Prevention/sendunits.txt");
+ unlink("GameEngine/Prevention/sendunits.txt");
}
}
@@ -2542,8 +2492,8 @@ $crannyimg = "
query_return($q);
foreach($dataarray as $data) {
@@ -2606,14 +2556,14 @@ $crannyimg = "
query_return($q);
@@ -2653,14 +2603,14 @@ $crannyimg = "
query_return($q);
@@ -2701,14 +2651,14 @@ $crannyimg = "
query_return($q);
@@ -2728,7 +2678,7 @@ $crannyimg = "
query($q);
}
if(file_exists("GameEngine/Prevention/research.txt")) {
- @unlink("GameEngine/Prevention/research.txt");
+ unlink("GameEngine/Prevention/research.txt");
}
}
@@ -2762,20 +2712,6 @@ $crannyimg = "
bountyocounter = $this->bountysortOasis();
$this->bountypop = $this->bountyinfoarray['pop'];
- //$unitarray = $database->getUnit($bountywid);
- //if(count($unitarray) > 0) {
- // for($i=1;$i<=50;$i++) {
- // $this->bountyunitall['u'.$i] = $unitarray['u'.$i];
- // }
- //}
- //$enforcearray = $database->getEnforceVillage($bountywid,0);
- //if(count($enforcearray) > 0) {
- // foreach($enforcearray as $enforce) {
- // for($i=1;$i<=50;$i++) {
- // $this->bountyunitall['u'.$i] += $enforce['u'.$i];
- // }
- // }
- //}
}
private function bountysortOasis() {
@@ -2944,7 +2880,6 @@ $crannyimg = "
bountyocounter[0] != 0) {
$wood += $wood*0.25*$this->bountyocounter[0];
}
-// $wood += $wood*$this->bountyocounter[0]*0.25;
$wood *= SPEED;
return round($wood);
}
@@ -2995,7 +2930,6 @@ $crannyimg = "
bountyocounter[1] != 0) {
$clay += $clay*0.25*$this->bountyocounter[1];
}
-// $clay += $clay*$this->bountyocounter[1]*0.25;
$clay *= SPEED;
return round($clay);
}
@@ -3019,7 +2953,6 @@ $crannyimg = "
bountyocounter[2] != 0) {
$iron += $iron*0.25*$this->bountyocounter[2];
}
-// $iron += $iron*$this->bountyocounter[2]*0.25;
$iron *= SPEED;
return round($iron);
}
@@ -3049,16 +2982,14 @@ $crannyimg = "
bountyocounter[3] != 0) {
$crop += $crop*0.25*$this->bountyocounter[3];
}
-
-// $crop += $crop*$this->bountyocounter[3]*0.25;
$crop *= SPEED;
return round($crop);
}
private function trainingComplete() {
global $database;
- $ourFileHandle = @fopen("GameEngine/Prevention/training.txt", 'w');
- @fclose($ourFileHandle);
+ $ourFileHandle = fopen("GameEngine/Prevention/training.txt", 'w');
+ fclose($ourFileHandle);
$trainlist = $database->getTrainingList();
if(count($trainlist) > 0) {
foreach($trainlist as $train) {
@@ -3088,7 +3019,7 @@ $crannyimg = "
getsort_typeMaxLevel($tid)) {
// $target = $i;
//}
}
+ */
}
}
else if($element == 1) {
@@ -3184,8 +3116,8 @@ $crannyimg = "
getCel();
foreach($varray as $vil){
@@ -3197,14 +3129,14 @@ $crannyimg = "
setCelCp($user,$cp);
}
if(file_exists("GameEngine/Prevention/celebration.txt")) {
- @unlink("GameEngine/Prevention/celebration.txt");
+ unlink("GameEngine/Prevention/celebration.txt");
}
}
private function demolitionComplete() {
global $building,$database;
- $ourFileHandle = @fopen("GameEngine/Prevention/demolition.txt", 'w');
- @fclose($ourFileHandle);
+ $ourFileHandle = fopen("GameEngine/Prevention/demolition.txt", 'w');
+ fclose($ourFileHandle);
$varray = $database->getDemolition();
foreach($varray as $vil) {
@@ -3233,7 +3165,7 @@ $crannyimg = "
+ // by SlimShady95, aka Manuel Mannhardt < manuel_mannhardt@web.de > UPDATED FROM songeriux < haroldas.snei@gmail.com >
private function updateStore() {
global $bid10, $bid38, $bid11, $bid39;
@@ -3413,8 +3345,8 @@ $crannyimg = "
30,
@@ -3609,15 +3541,11 @@ $crannyimg = "
setVillageField($starv['wref'], 'crop', $newcrop);
}
}
- unset ($starv);
- unset ($unitarray);
- unset ($enforcearray);
- unset ($enforce);
- unset ($starvarray);
+ unset ($starv,$unitarray,$enforcearray,$enforce,$starvarray);
}
if(file_exists("GameEngine/Prevention/starvation.txt")) {
- @unlink("GameEngine/Prevention/starvation.txt");
+ unlink("GameEngine/Prevention/starvation.txt");
}
}
diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php
index 0d36a592..50fddd0c 100644
--- a/GameEngine/Battle.php
+++ b/GameEngine/Battle.php
@@ -533,20 +533,14 @@ class Battle {
$total_att_units = count($units['Att_unit']);
$start = intval(($att_tribe-1)*10+1);
$end = intval(($att_tribe*10));
- //exit($start."|".$end."|".$att_tribe);
- //$y=1;
+
for($i=$start;$i <= $end;$i++)
{
$y = $i-(($att_tribe-1)*10);
- //exit(intval("$y"));
$result['casualties_attacker'][$y] = round($result[1]*$units['Att_unit'][$i]);
- //$y++;
- //exit($result['casualties_attacker'][$y]);
}
- //$result['casualties_attacker']['11'] = 0;
- //exit($result['casualties_attacker']['2']);
- //$_hero=11;
+
if ($units['Att_unit']['hero']>0)
{
@@ -568,18 +562,9 @@ class Battle {
mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'");
}
}
- unset($_result);
- unset($fdb);
- unset($hero_id);
- unset($hero_health);
- unset($damage_health);
+ unset($_result,$fdb,$hero_id,$hero_health,$damage_health);
- //exit($result['casualties_attacker']['11']);
- //$result['casualties_attacker'][11] = round($result[1]*$units['Att_unit']['hero']);
- //$result['casualties_defender']['11'] = 0;
- //exit($result['casualties_defender']['2']);
- //$_hero=11;
if ($units['Def_unit']['hero']>0)
{
@@ -588,7 +573,6 @@ class Battle {
$hero_id=$fdb['heroid'];
$hero_health=$fdb['health'];
$damage_health=round(100*$result[2]);
- //exit($damage_health."|".$hero_health."|".$defhero['heroid']);
if ($hero_health<=$damage_health or $damage_health>90)
{
//hero die
@@ -601,11 +585,7 @@ class Battle {
$result['deadherodef'] = 0;
mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'");
}
- unset($_result);
- unset($fdb);
- unset($hero_id);
- unset($hero_health);
- unset($damage_health);
+ unset($_result,$fdb,$hero_id,$hero_health,$damage_health);
$DefendersAll = $database->getEnforceVillage($DefenderWref,0);
if(!empty($DefendersAll)){
@@ -619,7 +599,6 @@ class Battle {
$hero_id=$fdb['heroid'];
$hero_health=$fdb['health'];
$damage_health=round(100*$result[2]);
- //exit($damage_health."|".$hero_health."|".$defhero['heroid']);
if ($hero_health<=$damage_health or $damage_health>90)
{
//hero die
@@ -637,14 +616,7 @@ class Battle {
}
}
- unset($_result);
- unset($fdb);
- unset($hero_id);
- unset($hero_health);
- unset($damage_health);
-
- //exit($result['casualties_defender']['11']);
- //$result['casualties_defender'][11] = round($result[1]*$units['Def_unit']['hero']);
+ unset($_result,$fdb,$hero_id,$hero_health,$damage_health);
// Work out bounty
diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php
index c0ffae9a..a0943434 100644
--- a/GameEngine/Lang/en.php
+++ b/GameEngine/Lang/en.php
@@ -268,9 +268,9 @@ define("CHOOSE","Please choose a server.");
define("STARTED"," The server started ". round((time()-COMMENCE)/86400) ." days ago.");
//ANMELDEN.php
-define("NICKNAME","Nickname");
+define("NICKNAME","Nickname [a-z, A-Z, 0-9 , _, -]");
define("EMAIL","Email");
-define("PASSWORD","Password");
+define("PASSWORD","Password [a-z, A-Z, 0-9]");
define("ROMANS","Romans");
define("TEUTONS","Teutons");
define("GAULS","Gauls");
@@ -356,4 +356,4 @@ define("MASS_SENT","Mass IGM was sent");
$lang['login'] = "Login";
-?>
+?>
\ No newline at end of file
diff --git a/Templates/Ranking/general.tpl b/Templates/Ranking/general.tpl
index 33e36897..cc22b598 100644
--- a/Templates/Ranking/general.tpl
+++ b/Templates/Ranking/general.tpl
@@ -9,11 +9,11 @@
| Copyright: TravianX Project All rights reserved |
\** --------------------------------------------------- **/
- $tribe1 = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE tribe = 1");
- $tribe2 = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE tribe = 2");
- $tribe3 = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE tribe = 3");
+ $tribe1 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE tribe = 1");
+ $tribe2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE tribe = 2");
+ $tribe3 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE tribe = 3");
$tribes = array(mysql_num_rows($tribe1), mysql_num_rows($tribe2), mysql_num_rows($tribe3));
- $users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users")) - 4; ?>
+ $users = mysql_num_rows(mysql_query("SELECT * FROM " . TB_PREFIX . "users WHERE tribe!=0 AND tribe!=4 AND tribe!=5")); ?>
@@ -34,7 +34,7 @@
Active players
@@ -42,7 +42,7 @@
Players online
diff --git a/index.php b/index.php
index 0a090e01..e3e4d3d6 100644
--- a/index.php
+++ b/index.php
@@ -132,7 +132,7 @@ include ("GameEngine/Lang/".LANG.".php");
diff --git a/install/templates/config.tpl b/install/templates/config.tpl
index 4e57a941..c7b636c4 100644
--- a/install/templates/config.tpl
+++ b/install/templates/config.tpl
@@ -127,7 +127,7 @@ echo " Prefix:
Type:
LOG RELATED
| WARNING: May increase some preformence (Higher CPU/RAM usage, More lag) | +|
| Log Building: | |
| Limit Mailbox: | |
| Max mails: | |
| Max mails: | (NOT DONE) |
| Demolish - lvl required: |