mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-30 07:07:14 +00:00
refactor: SELECT * replaced by SELECT fieldname1, fieldname2 ...
So far in a few places.
This commit is contained in:
@@ -149,7 +149,7 @@ class Account {
|
|||||||
if(START_DATE < date('m/d/Y') or START_DATE == date('m/d/Y') && START_TIME <= date('H:i'))
|
if(START_DATE < date('m/d/Y') or START_DATE == date('m/d/Y') && START_TIME <= date('H:i'))
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
|
$q = "SELECT act, username, password, email, tribe, kid FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
$dbarray = mysqli_fetch_array($result);
|
$dbarray = mysqli_fetch_array($result);
|
||||||
if($dbarray['act'] == $_POST['id']) {
|
if($dbarray['act'] == $_POST['id']) {
|
||||||
@@ -177,7 +177,7 @@ class Account {
|
|||||||
|
|
||||||
private function Unreg() {
|
private function Unreg() {
|
||||||
global $database;
|
global $database;
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."activate where id = '".$database->escape((int) $_POST['id'])."'";
|
$q = "SELECT password, username FROM ".TB_PREFIX."activate where id = '".$database->escape((int) $_POST['id'])."'";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
$dbarray = mysqli_fetch_array($result);
|
$dbarray = mysqli_fetch_array($result);
|
||||||
if(password_verify($_POST['pw'], $dbarray['password'])) {
|
if(password_verify($_POST['pw'], $dbarray['password'])) {
|
||||||
|
|||||||
+123
-76
@@ -249,7 +249,7 @@ class Automation {
|
|||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
global $database;
|
global $database;
|
||||||
$array = array();
|
$array = array();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE loyalty<>100";
|
$q = "SELECT wref, loyalty, lastupdate2 FROM ".TB_PREFIX."vdata WHERE loyalty<>100";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
if(!empty($array)) {
|
if(!empty($array)) {
|
||||||
foreach($array as $loyalty) {
|
foreach($array as $loyalty) {
|
||||||
@@ -266,7 +266,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$array = array();
|
$array = array();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE loyalty<>100";
|
$q = "SELECT conqured, loyalty, lastupdated, wref FROM ".TB_PREFIX."odata WHERE loyalty<>100";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
if(!empty($array)) {
|
if(!empty($array)) {
|
||||||
foreach($array as $loyalty) {
|
foreach($array as $loyalty) {
|
||||||
@@ -432,7 +432,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($i=0;$i<20;$i++){
|
for($i=0;$i<20;$i++){
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."users where friend".$i." = ".(int) $need['uid']." or friend".$i."wait = ".(int) $need['uid']."";
|
$q = "SELECT id FROM ".TB_PREFIX."users where friend".$i." = ".(int) $need['uid']." or friend".$i."wait = ".(int) $need['uid']."";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $friend){
|
foreach($array as $friend){
|
||||||
$database->deleteFriend($friend['id'],"friend".$i);
|
$database->deleteFriend($friend['id'],"friend".$i);
|
||||||
@@ -490,7 +490,7 @@ class Automation {
|
|||||||
private function pruneOResource() {
|
private function pruneOResource() {
|
||||||
global $database;
|
global $database;
|
||||||
if(!ALLOW_BURST) {
|
if(!ALLOW_BURST) {
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE maxstore < 800 OR maxcrop < 800";
|
$q = "SELECT maxstore, maxcrop, wref FROM ".TB_PREFIX."odata WHERE maxstore < 800 OR maxcrop < 800";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $getoasis) {
|
foreach($array as $getoasis) {
|
||||||
if($getoasis['maxstore'] < 800){
|
if($getoasis['maxstore'] < 800){
|
||||||
@@ -506,7 +506,7 @@ class Automation {
|
|||||||
$q = "UPDATE " . TB_PREFIX . "odata set maxstore = $maxstore, maxcrop = $maxcrop where wref = ".$getoasis['wref']."";
|
$q = "UPDATE " . TB_PREFIX . "odata set maxstore = $maxstore, maxcrop = $maxcrop where wref = ".$getoasis['wref']."";
|
||||||
$database->query($q);
|
$database->query($q);
|
||||||
}
|
}
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0";
|
$q = "SELECT wood, clay, iron, crop, wref FROM ".TB_PREFIX."odata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $getoasis) {
|
foreach($array as $getoasis) {
|
||||||
if($getoasis['wood'] < 0){
|
if($getoasis['wood'] < 0){
|
||||||
@@ -537,7 +537,7 @@ class Automation {
|
|||||||
private function pruneResource() {
|
private function pruneResource() {
|
||||||
global $database;
|
global $database;
|
||||||
if(!ALLOW_BURST) {
|
if(!ALLOW_BURST) {
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE maxstore < 800 OR maxcrop < 800";
|
$q = "SELECT maxstore, maxcrop, wref FROM ".TB_PREFIX."vdata WHERE maxstore < 800 OR maxcrop < 800";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $getvillage) {
|
foreach($array as $getvillage) {
|
||||||
if($getvillage['maxstore'] < 800){
|
if($getvillage['maxstore'] < 800){
|
||||||
@@ -553,7 +553,7 @@ class Automation {
|
|||||||
$q = "UPDATE " . TB_PREFIX . "vdata set maxstore = $maxstore, maxcrop = $maxcrop where wref = ".(int) $getvillage['wref']."";
|
$q = "UPDATE " . TB_PREFIX . "vdata set maxstore = $maxstore, maxcrop = $maxcrop where wref = ".(int) $getvillage['wref']."";
|
||||||
$database->query($q);
|
$database->query($q);
|
||||||
}
|
}
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE wood > maxstore OR clay > maxstore OR iron > maxstore OR crop > maxcrop";
|
$q = "SELECT maxstore, maxcrop, wood, clay, iron, crop, wref FROM ".TB_PREFIX."vdata WHERE wood > maxstore OR clay > maxstore OR iron > maxstore OR crop > maxcrop";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $getvillage) {
|
foreach($array as $getvillage) {
|
||||||
if($getvillage['wood'] > $getvillage['maxstore']){
|
if($getvillage['wood'] > $getvillage['maxstore']){
|
||||||
@@ -571,15 +571,15 @@ class Automation {
|
|||||||
}else{
|
}else{
|
||||||
$iron = $getvillage['iron'];
|
$iron = $getvillage['iron'];
|
||||||
}
|
}
|
||||||
if($getvillage['crop'] > $getvillage['maxstore']){
|
if($getvillage['crop'] > $getvillage['maxcrop']){
|
||||||
$crop = $getvillage['maxstore'];
|
$crop = $getvillage['maxcrop'];
|
||||||
}else{
|
}else{
|
||||||
$crop = $getvillage['crop'];
|
$crop = $getvillage['crop'];
|
||||||
}
|
}
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set wood = $wood, clay = $clay, iron = $iron, crop = $crop where wref = ".(int) $getvillage['wref']."";
|
$q = "UPDATE " . TB_PREFIX . "vdata set wood = $wood, clay = $clay, iron = $iron, crop = $crop where wref = ".(int) $getvillage['wref']."";
|
||||||
$database->query($q);
|
$database->query($q);
|
||||||
}
|
}
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0";
|
$q = "SELECT wood, clay, iron, crop, wref FROM ".TB_PREFIX."vdata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $getvillage) {
|
foreach($array as $getvillage) {
|
||||||
if($getvillage['wood'] < 0){
|
if($getvillage['wood'] < 0){
|
||||||
@@ -647,7 +647,7 @@ class Automation {
|
|||||||
global $database,$bid18,$bid10,$bid11,$bid38,$bid39;
|
global $database,$bid18,$bid10,$bid11,$bid38,$bid39;
|
||||||
$time = time();
|
$time = time();
|
||||||
$array = array();
|
$array = array();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."bdata where timestamp < $time and master = 0";
|
$q = "SELECT id, wid, field, level, type, timestamp FROM ".TB_PREFIX."bdata where timestamp < $time and master = 0";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $indi) {
|
foreach($array as $indi) {
|
||||||
$level = $database->getFieldLevel($indi['wid'],$indi['field']);
|
$level = $database->getFieldLevel($indi['wid'],$indi['field']);
|
||||||
@@ -910,7 +910,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function checkWWAttacks() {
|
private function checkWWAttacks() {
|
||||||
$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'ww_attacks` WHERE `attack_time` <= ' . time());
|
$query = mysqli_query($GLOBALS['link'],'SELECT vid, attack_time FROM `' . TB_PREFIX . 'ww_attacks` WHERE `attack_time` <= ' . time());
|
||||||
while ($row = mysqli_fetch_assoc($query))
|
while ($row = mysqli_fetch_assoc($query))
|
||||||
{
|
{
|
||||||
// delete the attack
|
// delete the attack
|
||||||
@@ -937,7 +937,7 @@ class Automation {
|
|||||||
private function TradeRoute() {
|
private function TradeRoute() {
|
||||||
global $database;
|
global $database;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."route where timestamp < $time";
|
$q = "SELECT `from`, wood, clay, iron, crop, wid, deliveries, id FROM ".TB_PREFIX."route where timestamp < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
foreach($dataarray as $data) {
|
foreach($dataarray as $data) {
|
||||||
$database->modifyResource($data['from'],$data['wood'],$data['clay'],$data['iron'],$data['crop'],0);
|
$database->modifyResource($data['from'],$data['wood'],$data['clay'],$data['iron'],$data['crop'],0);
|
||||||
@@ -955,7 +955,7 @@ class Automation {
|
|||||||
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/market.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/market.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 0 and endtime < $time";
|
$q = "SELECT s.wood, s.clay, s.iron, s.crop, `to`, `from`, endtime, merchant, send, moveid FROM ".TB_PREFIX."movement m, ".TB_PREFIX."send s WHERE m.ref = s.id AND m.proc = 0 AND sort_type = 0 AND endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
foreach($dataarray as $data) {
|
foreach($dataarray as $data) {
|
||||||
|
|
||||||
@@ -982,7 +982,7 @@ class Automation {
|
|||||||
$database->addMovement(2,$data['to'],$data['from'],$data['merchant'],time(),$endtime,$data['send'],$data['wood'],$data['clay'],$data['iron'],$data['crop']);
|
$database->addMovement(2,$data['to'],$data['from'],$data['merchant'],time(),$endtime,$data['send'],$data['wood'],$data['clay'],$data['iron'],$data['crop']);
|
||||||
$database->setMovementProc($data['moveid']);
|
$database->setMovementProc($data['moveid']);
|
||||||
}
|
}
|
||||||
$q1 = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 2 and endtime < $time";
|
$q1 = "SELECT send, moveid, `to`, wood, clay, iron, crop, `from` FROM ".TB_PREFIX."movement WHERE proc = 0 and sort_type = 2 and endtime < $time";
|
||||||
$dataarray1 = $database->query_return($q1);
|
$dataarray1 = $database->query_return($q1);
|
||||||
foreach($dataarray1 as $data1) {
|
foreach($dataarray1 as $data1) {
|
||||||
$database->setMovementProc($data1['moveid']);
|
$database->setMovementProc($data1['moveid']);
|
||||||
@@ -1040,7 +1040,24 @@ class Automation {
|
|||||||
//$ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
|
//$ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
|
||||||
//fclose($ourFileHandle);
|
//fclose($ourFileHandle);
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type != '2' and endtime < $time ORDER BY endtime ASC";
|
$q = "
|
||||||
|
SELECT
|
||||||
|
`from`, `to`, endtime, ref, ctar1, ctar2, spy, moveid,
|
||||||
|
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11
|
||||||
|
FROM
|
||||||
|
".TB_PREFIX."movement,
|
||||||
|
".TB_PREFIX."attacks
|
||||||
|
WHERE
|
||||||
|
".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."movement.proc = 0
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."movement.sort_type = 3
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."attacks.attack_type != 2
|
||||||
|
AND
|
||||||
|
endtime < $time
|
||||||
|
ORDER BY endtime ASC";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
$totalattackdead = 0;
|
$totalattackdead = 0;
|
||||||
$data_num = 0;
|
$data_num = 0;
|
||||||
@@ -1897,7 +1914,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($herosend_att>0){
|
if ($herosend_att>0){
|
||||||
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
||||||
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
||||||
$hero_f=mysqli_fetch_array($resulth);
|
$hero_f=mysqli_fetch_array($resulth);
|
||||||
$hero_unit=$hero_f['unit'];
|
$hero_unit=$hero_f['unit'];
|
||||||
@@ -2827,7 +2844,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($prisoner['t11']>0){
|
if ($prisoner['t11']>0){
|
||||||
$p_qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $p_owner." AND dead = 0";
|
$p_qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $p_owner." AND dead = 0";
|
||||||
$p_resulth = $database->query($p_qh);
|
$p_resulth = $database->query($p_qh);
|
||||||
$p_hero_f=mysqli_fetch_array($p_resulth);
|
$p_hero_f=mysqli_fetch_array($p_resulth);
|
||||||
$p_hero_unit=$p_hero_f['unit'];
|
$p_hero_unit=$p_hero_f['unit'];
|
||||||
@@ -3001,7 +3018,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($herosend_att>0){
|
if ($herosend_att>0){
|
||||||
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
||||||
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
||||||
$hero_f=mysqli_fetch_array($resulth);
|
$hero_f=mysqli_fetch_array($resulth);
|
||||||
$hero_unit=$hero_f['unit'];
|
$hero_unit=$hero_f['unit'];
|
||||||
@@ -3282,7 +3299,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
if (isset($post['t11'])){
|
if (isset($post['t11'])){
|
||||||
if( $post['t11'] != '' && $post['t11'] > 0){
|
if( $post['t11'] != '' && $post['t11'] > 0){
|
||||||
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0";
|
||||||
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
$resulth = mysqli_query($GLOBALS['link'],$qh);
|
||||||
$hero_f=mysqli_fetch_array($resulth);
|
$hero_f=mysqli_fetch_array($resulth);
|
||||||
$hero_unit=$hero_f['unit'];
|
$hero_unit=$hero_f['unit'];
|
||||||
@@ -3337,7 +3354,23 @@ class Automation {
|
|||||||
$time = time();
|
$time = time();
|
||||||
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/sendreinfunits.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/sendreinfunits.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type = '2' and endtime < $time";
|
$q = "
|
||||||
|
SELECT
|
||||||
|
`to`, `from`, moveid,
|
||||||
|
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11
|
||||||
|
FROM
|
||||||
|
".TB_PREFIX."movement,
|
||||||
|
".TB_PREFIX."attacks
|
||||||
|
WHERE
|
||||||
|
".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."movement.proc = 0
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."movement.sort_type = 3
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."attacks.attack_type = 2
|
||||||
|
AND
|
||||||
|
endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
|
|
||||||
if ($dataarray && count($dataarray)) {
|
if ($dataarray && count($dataarray)) {
|
||||||
@@ -3475,7 +3508,21 @@ class Automation {
|
|||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$reload=false;
|
$reload=false;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '4' and endtime < $time";
|
$q = "
|
||||||
|
SELECT
|
||||||
|
`to`, `from`, moveid,
|
||||||
|
t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11
|
||||||
|
FROM
|
||||||
|
".TB_PREFIX."movement,
|
||||||
|
".TB_PREFIX."attacks
|
||||||
|
WHERE
|
||||||
|
".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."movement.proc = 0
|
||||||
|
AND
|
||||||
|
".TB_PREFIX."movement.sort_type = 4
|
||||||
|
AND
|
||||||
|
endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
|
|
||||||
if ($dataarray && count($dataarray)) {
|
if ($dataarray && count($dataarray)) {
|
||||||
@@ -3508,7 +3555,7 @@ class Automation {
|
|||||||
|
|
||||||
// Recieve the bounty on type 6.
|
// Recieve the bounty on type 6.
|
||||||
|
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 6 and endtime < $time";
|
$q = "SELECT s.wood, s.clay, s.iron, s.crop, `to`, `from`, endtime, merchant, send, moveid FROM ".TB_PREFIX."movement m, ".TB_PREFIX."send s WHERE m.ref = s.id AND m.proc = 0 AND sort_type = 6 AND endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
foreach($dataarray as $data) {
|
foreach($dataarray as $data) {
|
||||||
|
|
||||||
@@ -3540,7 +3587,7 @@ class Automation {
|
|||||||
|
|
||||||
// Settlers
|
// Settlers
|
||||||
|
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement where ref = 0 and proc = '0' and sort_type = '4' and endtime < $time";
|
$q = "SELECT `to`, moveid FROM ".TB_PREFIX."movement where ref = 0 and proc = '0' and sort_type = '4' and endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
if ($dataarray && count($dataarray)) {
|
if ($dataarray && count($dataarray)) {
|
||||||
foreach($dataarray as $data) {
|
foreach($dataarray as $data) {
|
||||||
@@ -3567,7 +3614,7 @@ class Automation {
|
|||||||
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/settlers.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/settlers.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time";
|
$q = "SELECT `to`, `from`, moveid, starttime, ref FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
foreach($dataarray as $data) {
|
foreach($dataarray as $data) {
|
||||||
$ownerID = $database->getUserField($database->getVillageField($data['from'],"owner"),"id",0);
|
$ownerID = $database->getUserField($database->getVillageField($data['from'],"owner"),"id",0);
|
||||||
@@ -3624,7 +3671,7 @@ class Automation {
|
|||||||
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/research.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/research.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."research where timestamp < $time";
|
$q = "SELECT tech, vref, id FROM ".TB_PREFIX."research where timestamp < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
foreach($dataarray as $data) {
|
foreach($dataarray as $data) {
|
||||||
$sort_type = substr($data['tech'],0,1);
|
$sort_type = substr($data['tech'],0,1);
|
||||||
@@ -4378,7 +4425,7 @@ class Automation {
|
|||||||
private function oasisResourcesProduce() {
|
private function oasisResourcesProduce() {
|
||||||
global $database;
|
global $database;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 800 OR clay < 800 OR iron < 800 OR crop < 800";
|
$q = "SELECT wood, clay, iron, crop, lastupdated, maxstore, maxcrop, wref FROM ".TB_PREFIX."odata WHERE wood < 800 OR clay < 800 OR iron < 800 OR crop < 800";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $getoasis) {
|
foreach($array as $getoasis) {
|
||||||
$oasiswood = $getoasis['wood'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
|
$oasiswood = $getoasis['wood'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
|
||||||
@@ -4405,11 +4452,11 @@ class Automation {
|
|||||||
|
|
||||||
private function checkInvitedPlayes() {
|
private function checkInvitedPlayes() {
|
||||||
global $database;
|
global $database;
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."users WHERE invited > 0";
|
$q = "SELECT id, invited FROM ".TB_PREFIX."users WHERE invited > 0";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $user) {
|
foreach($array as $user) {
|
||||||
$numusers = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE id = ".(int) $user['invited']);
|
$numusers = mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM ".TB_PREFIX."users WHERE id = ".(int) $user['invited']), MYSQLI_ASSOC);
|
||||||
if(mysqli_num_rows($numusers) > 0){
|
if($numusers['Total'] > 0){
|
||||||
$varray = count($database->getProfileVillages($user['id']));
|
$varray = count($database->getProfileVillages($user['id']));
|
||||||
if($varray > 1){
|
if($varray > 1){
|
||||||
$usergold = $database->getUserField($user['invited'],"gold",0);
|
$usergold = $database->getUserField($user['invited'],"gold",0);
|
||||||
@@ -4424,7 +4471,7 @@ class Automation {
|
|||||||
private function updateGeneralAttack() {
|
private function updateGeneralAttack() {
|
||||||
global $database;
|
global $database;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."general WHERE shown = 1";
|
$q = "SELECT id, time FROM ".TB_PREFIX."general WHERE shown = 1";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $general) {
|
foreach($array as $general) {
|
||||||
if(time() - (86400*8) > $general['time']){
|
if(time() - (86400*8) > $general['time']){
|
||||||
@@ -4435,7 +4482,7 @@ class Automation {
|
|||||||
|
|
||||||
private function MasterBuilder() {
|
private function MasterBuilder() {
|
||||||
global $database;
|
global $database;
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."bdata WHERE master = 1";
|
$q = "SELECT id, wid, type, level, field, timestamp FROM ".TB_PREFIX."bdata WHERE master = 1";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $master) {
|
foreach($array as $master) {
|
||||||
$owner = $database->getVillageField($master['wid'],'owner');
|
$owner = $database->getVillageField($master['wid'],'owner');
|
||||||
@@ -4741,7 +4788,7 @@ class Automation {
|
|||||||
$ranking->procRankArray();
|
$ranking->procRankArray();
|
||||||
$climbers = $ranking->getRank();
|
$climbers = $ranking->getRank();
|
||||||
if(count($ranking->getRank()) > 0){
|
if(count($ranking->getRank()) > 0){
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
$q = "SELECT week FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
if(mysqli_num_rows($result)) {
|
if(mysqli_num_rows($result)) {
|
||||||
$row=mysqli_fetch_assoc($result);
|
$row=mysqli_fetch_assoc($result);
|
||||||
@@ -4749,7 +4796,7 @@ class Automation {
|
|||||||
} else {
|
} else {
|
||||||
$week='1';
|
$week='1';
|
||||||
}
|
}
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."users where oldrank = 0 and id > 5";
|
$q = "SELECT id FROM ".TB_PREFIX."users where oldrank = 0 and id > 5";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $user){
|
foreach($array as $user){
|
||||||
$newrank = $ranking->getUserRank($user['id']);
|
$newrank = $ranking->getUserRank($user['id']);
|
||||||
@@ -4790,7 +4837,7 @@ class Automation {
|
|||||||
$ranking->procRankArray();
|
$ranking->procRankArray();
|
||||||
$climbers = $ranking->getRank();
|
$climbers = $ranking->getRank();
|
||||||
if(count($ranking->getRank()) > 0){
|
if(count($ranking->getRank()) > 0){
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
$q = "SELECT week FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
if(mysqli_num_rows($result)) {
|
if(mysqli_num_rows($result)) {
|
||||||
$row=mysqli_fetch_assoc($result);
|
$row=mysqli_fetch_assoc($result);
|
||||||
@@ -4872,7 +4919,7 @@ class Automation {
|
|||||||
private function checkBan() {
|
private function checkBan() {
|
||||||
global $database;
|
global $database;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."banlist WHERE active = 1 and end < $time";
|
$q = "SELECT id, uid FROM ".TB_PREFIX."banlist WHERE active = 1 and end < $time";
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
foreach($array as $banlist) {
|
foreach($array as $banlist) {
|
||||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."banlist SET active = 0 WHERE id = ".(int) $banlist['id']."");
|
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."banlist SET active = 0 WHERE id = ".(int) $banlist['id']."");
|
||||||
@@ -4947,7 +4994,7 @@ class Automation {
|
|||||||
//we may give away ribbons
|
//we may give away ribbons
|
||||||
|
|
||||||
$giveMedal = false;
|
$giveMedal = false;
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."config";
|
$q = "SELECT lastgavemedal FROM ".TB_PREFIX."config";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
if($result) {
|
if($result) {
|
||||||
$row=mysqli_fetch_assoc($result);
|
$row=mysqli_fetch_assoc($result);
|
||||||
@@ -4966,7 +5013,7 @@ class Automation {
|
|||||||
|
|
||||||
//determine which week we are
|
//determine which week we are
|
||||||
|
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
$q = "SELECT week FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
if(mysqli_num_rows($result)) {
|
if(mysqli_num_rows($result)) {
|
||||||
$row=mysqli_fetch_assoc($result);
|
$row=mysqli_fetch_assoc($result);
|
||||||
@@ -4977,7 +5024,7 @@ class Automation {
|
|||||||
|
|
||||||
//Do same for ally week
|
//Do same for ally week
|
||||||
|
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."allimedal order by week DESC LIMIT 0, 1";
|
$q = "SELECT week FROM ".TB_PREFIX."allimedal order by week DESC LIMIT 0, 1";
|
||||||
$result = mysqli_query($GLOBALS['link'],$q);
|
$result = mysqli_query($GLOBALS['link'],$q);
|
||||||
if(mysqli_num_rows($result)) {
|
if(mysqli_num_rows($result)) {
|
||||||
$row=mysqli_fetch_assoc($result);
|
$row=mysqli_fetch_assoc($result);
|
||||||
@@ -4988,7 +5035,7 @@ class Automation {
|
|||||||
|
|
||||||
|
|
||||||
//Attackers of the week
|
//Attackers of the week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, ap FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
$i++;
|
$i++;
|
||||||
@@ -4998,7 +5045,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Defender of the week
|
//Defender of the week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, dp FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
$i++;
|
$i++;
|
||||||
@@ -5008,7 +5055,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Climbers of the week
|
//Climbers of the week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, Rc FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
$i++;
|
$i++;
|
||||||
@@ -5018,7 +5065,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Rank climbers of the week
|
//Rank climbers of the week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, clp FROM ".TB_PREFIX."users ORDER BY clp DESC Limit 10");
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
$i++;
|
$i++;
|
||||||
@@ -5028,7 +5075,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Robbers of the week
|
//Robbers of the week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, RR FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
|
||||||
$i=0;
|
$i=0;
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
$i++;
|
$i++;
|
||||||
@@ -5039,15 +5086,15 @@ class Automation {
|
|||||||
|
|
||||||
//Part of the bonus for top 10 attack + defense out
|
//Part of the bonus for top 10 attack + defense out
|
||||||
//Top10 attackers
|
//Top10 attackers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
//Top 10 defenders
|
//Top 10 defenders
|
||||||
$result2 = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
$result2 = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
||||||
while($row2 = mysqli_fetch_array($result2)){
|
while($row2 = mysqli_fetch_array($result2)){
|
||||||
if($row['id']==$row2['id']){
|
if($row['id']==$row2['id']){
|
||||||
|
|
||||||
$query3="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 5";
|
$query3="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 5";
|
||||||
$result3=mysqli_query($GLOBALS['link'],$query3);
|
$result3=mysqli_query($GLOBALS['link'],$query3);
|
||||||
$row3=mysqli_fetch_row($result3);
|
$row3=mysqli_fetch_row($result3);
|
||||||
|
|
||||||
@@ -5074,10 +5121,10 @@ class Automation {
|
|||||||
|
|
||||||
//you stand for 3rd / 5th / 10th time in the top 3 strikers
|
//you stand for 3rd / 5th / 10th time in the top 3 strikers
|
||||||
//top10 attackers
|
//top10 attackers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 1 AND plaats<=3";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 1 AND plaats<=3";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5104,10 +5151,10 @@ class Automation {
|
|||||||
}
|
}
|
||||||
//you stand for 3rd / 5th / 10th time in the top 10 attackers
|
//you stand for 3rd / 5th / 10th time in the top 10 attackers
|
||||||
//top10 attackers
|
//top10 attackers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY ap DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 1 AND plaats<=10";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 1 AND plaats<=10";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5134,10 +5181,10 @@ class Automation {
|
|||||||
}
|
}
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
|
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
|
||||||
//Pak de top10 verdedigers
|
//Pak de top10 verdedigers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 2 AND plaats<=3";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 2 AND plaats<=3";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5164,10 +5211,10 @@ class Automation {
|
|||||||
}
|
}
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
|
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
|
||||||
//Pak de top10 verdedigers
|
//Pak de top10 verdedigers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY dp DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 2 AND plaats<=10";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 2 AND plaats<=10";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5195,10 +5242,10 @@ class Automation {
|
|||||||
|
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
||||||
//Pak de top10 klimmers
|
//Pak de top10 klimmers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 3 AND plaats<=3";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 3 AND plaats<=3";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5224,10 +5271,10 @@ class Automation {
|
|||||||
}
|
}
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
||||||
//Pak de top10 klimmers
|
//Pak de top10 klimmers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY Rc DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 3 AND plaats<=10";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 3 AND plaats<=10";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5254,10 +5301,10 @@ class Automation {
|
|||||||
|
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
||||||
//Pak de top3 rank climbers
|
//Pak de top3 rank climbers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY clp DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 10 AND plaats<=3";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 10 AND plaats<=3";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5283,10 +5330,10 @@ class Automation {
|
|||||||
}
|
}
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 10klimmers
|
//je staat voor 3e / 5e / 10e keer in de top 10klimmers
|
||||||
//Pak de top3 rank climbers
|
//Pak de top3 rank climbers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY clp DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY clp DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 10 AND plaats<=10";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 10 AND plaats<=10";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5313,10 +5360,10 @@ class Automation {
|
|||||||
|
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
|
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
|
||||||
//Pak de top10 overvallers
|
//Pak de top10 overvallers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 4 AND plaats<=3";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 4 AND plaats<=3";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5342,10 +5389,10 @@ class Automation {
|
|||||||
}
|
}
|
||||||
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
|
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
|
||||||
//Pak de top10 overvallers
|
//Pak de top10 overvallers
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users ORDER BY RR DESC, id DESC Limit 10");
|
||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
$query1="SELECT count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 4 AND plaats<=10";
|
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 4 AND plaats<=10";
|
||||||
$result1=mysqli_query($GLOBALS['link'],$query1);
|
$result1=mysqli_query($GLOBALS['link'],$query1);
|
||||||
$row1=mysqli_fetch_row($result1);
|
$row1=mysqli_fetch_row($result1);
|
||||||
|
|
||||||
@@ -5371,7 +5418,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Put all true dens to 0
|
//Put all true dens to 0
|
||||||
$query="SELECT * FROM ".TB_PREFIX."users ORDER BY id+0 DESC";
|
$query="SELECT id FROM ".TB_PREFIX."users ORDER BY id+0 DESC";
|
||||||
$result=mysqli_query($GLOBALS['link'],$query);
|
$result=mysqli_query($GLOBALS['link'],$query);
|
||||||
for ($i=0; $row=mysqli_fetch_row($result); $i++){
|
for ($i=0; $row=mysqli_fetch_row($result); $i++){
|
||||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."users SET ap=0, dp=0,Rc=0,clp=0, RR=0 WHERE id = ".(int) $row[0]);
|
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."users SET ap=0, dp=0,Rc=0,clp=0, RR=0 WHERE id = ".(int) $row[0]);
|
||||||
@@ -5380,7 +5427,7 @@ class Automation {
|
|||||||
//Start alliance Medals wooot
|
//Start alliance Medals wooot
|
||||||
|
|
||||||
//Aanvallers v/d Week
|
//Aanvallers v/d Week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, ap FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
|
||||||
$i=0; while($row = mysqli_fetch_array($result)){
|
$i=0; while($row = mysqli_fetch_array($result)){
|
||||||
$i++; $img="a2_".($i)."";
|
$i++; $img="a2_".($i)."";
|
||||||
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '1', ".($i).", '".$allyweek."', '".$row['ap']."', '".$img."')";
|
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '1', ".($i).", '".$allyweek."', '".$row['ap']."', '".$img."')";
|
||||||
@@ -5388,7 +5435,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Verdediger v/d Week
|
//Verdediger v/d Week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, dp FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
|
||||||
$i=0; while($row = mysqli_fetch_array($result)){
|
$i=0; while($row = mysqli_fetch_array($result)){
|
||||||
$i++; $img="a3_".($i)."";
|
$i++; $img="a3_".($i)."";
|
||||||
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '2', ".($i).", '".$allyweek."', '".$row['dp']."', '".$img."')";
|
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '2', ".($i).", '".$allyweek."', '".$row['dp']."', '".$img."')";
|
||||||
@@ -5396,7 +5443,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Overvallers v/d Week
|
//Overvallers v/d Week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."alidata ORDER BY RR DESC, id DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, RR FROM ".TB_PREFIX."alidata ORDER BY RR DESC, id DESC Limit 10");
|
||||||
$i=0; while($row = mysqli_fetch_array($result)){
|
$i=0; while($row = mysqli_fetch_array($result)){
|
||||||
$i++; $img="a4_".($i)."";
|
$i++; $img="a4_".($i)."";
|
||||||
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '4', ".($i).", '".$allyweek."', '".$row['RR']."', '".$img."')";
|
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '4', ".($i).", '".$allyweek."', '".$row['RR']."', '".$img."')";
|
||||||
@@ -5404,7 +5451,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Rank climbers of the week
|
//Rank climbers of the week
|
||||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
|
$result = mysqli_query($GLOBALS['link'],"SELECT id, clp FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
|
||||||
$i=0; while($row = mysqli_fetch_array($result)){
|
$i=0; while($row = mysqli_fetch_array($result)){
|
||||||
$i++; $img="a1_".($i)."";
|
$i++; $img="a1_".($i)."";
|
||||||
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '3', ".($i).", '".$allyweek."', '".$row['clp']."', '".$img."')";
|
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '3', ".($i).", '".$allyweek."', '".$row['clp']."', '".$img."')";
|
||||||
@@ -5415,11 +5462,11 @@ class Automation {
|
|||||||
while($row = mysqli_fetch_array($result)){
|
while($row = mysqli_fetch_array($result)){
|
||||||
|
|
||||||
//Pak de top10 verdedigers
|
//Pak de top10 verdedigers
|
||||||
$result2 = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."alidata ORDER BY dp DESC, id DESC Limit 10");
|
$result2 = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."alidata ORDER BY dp DESC, id DESC Limit 10");
|
||||||
while($row2 = mysqli_fetch_array($result2)){
|
while($row2 = mysqli_fetch_array($result2)){
|
||||||
if($row['id']==$row2['id']){
|
if($row['id']==$row2['id']){
|
||||||
|
|
||||||
$query3="SELECT count(*) FROM ".TB_PREFIX."allimedal WHERE allyid=".(int) $row['id']." AND categorie = 5";
|
$query3="SELECT Count(*) FROM ".TB_PREFIX."allimedal WHERE allyid=".(int) $row['id']." AND categorie = 5";
|
||||||
$result3=mysqli_query($GLOBALS['link'],$query3);
|
$result3=mysqli_query($GLOBALS['link'],$query3);
|
||||||
$row3=mysqli_fetch_row($result3);
|
$row3=mysqli_fetch_row($result3);
|
||||||
|
|
||||||
@@ -5444,7 +5491,7 @@ class Automation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query="SELECT * FROM ".TB_PREFIX."alidata ORDER BY id+0 DESC";
|
$query="SELECT id FROM ".TB_PREFIX."alidata ORDER BY id+0 DESC";
|
||||||
$result=mysqli_query($GLOBALS['link'],$query);
|
$result=mysqli_query($GLOBALS['link'],$query);
|
||||||
for ($i=0; $row=mysqli_fetch_row($result); $i++){
|
for ($i=0; $row=mysqli_fetch_row($result); $i++){
|
||||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."alidata SET ap=0, dp=0, RR=0, clp=0 WHERE id = ".(int) $row[0]);
|
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."alidata SET ap=0, dp=0, RR=0, clp=0 WHERE id = ".(int) $row[0]);
|
||||||
@@ -5463,7 +5510,7 @@ class Automation {
|
|||||||
private function artefactOfTheFool() {
|
private function artefactOfTheFool() {
|
||||||
global $database;
|
global $database;
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts where type = 8 and active = 1 and lastupdate <= ".($time - 86400);
|
$q = "SELECT id, size FROM " . TB_PREFIX . "artefacts where type = 8 and active = 1 and lastupdate <= ".($time - 86400);
|
||||||
$array = $database->query_return($q);
|
$array = $database->query_return($q);
|
||||||
if ($array) {
|
if ($array) {
|
||||||
foreach($array as $artefact) {
|
foreach($array as $artefact) {
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ class Battle {
|
|||||||
|
|
||||||
if (isset($units['Att_unit']['hero']) && $units['Att_unit']['hero'] >0){
|
if (isset($units['Att_unit']['hero']) && $units['Att_unit']['hero'] >0){
|
||||||
|
|
||||||
$_result=mysqli_query($GLOBALS['link'],"select * from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $atkhero['heroid']);
|
$_result=mysqli_query($GLOBALS['link'],"select heroid, health from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $atkhero['heroid']);
|
||||||
$fdb = mysqli_fetch_array($_result);
|
$fdb = mysqli_fetch_array($_result);
|
||||||
$hero_id=(int) $fdb['heroid'];
|
$hero_id=(int) $fdb['heroid'];
|
||||||
$hero_health=$fdb['health'];
|
$hero_health=$fdb['health'];
|
||||||
@@ -679,7 +679,7 @@ class Battle {
|
|||||||
|
|
||||||
if (isset($units['Def_unit']['hero']) && $units['Def_unit']['hero'] >0){
|
if (isset($units['Def_unit']['hero']) && $units['Def_unit']['hero'] >0){
|
||||||
|
|
||||||
$_result=mysqli_query($GLOBALS['link'],"select * from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $defenderhero['heroid']);
|
$_result=mysqli_query($GLOBALS['link'],"select heroid, health from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $defenderhero['heroid']);
|
||||||
$fdb = mysqli_fetch_array($_result);
|
$fdb = mysqli_fetch_array($_result);
|
||||||
$hero_id=(int) $fdb['heroid'];
|
$hero_id=(int) $fdb['heroid'];
|
||||||
$hero_health=$fdb['health'];
|
$hero_health=$fdb['health'];
|
||||||
@@ -703,7 +703,7 @@ class Battle {
|
|||||||
if(!empty($heroarray)) { reset($heroarray); }
|
if(!empty($heroarray)) { reset($heroarray); }
|
||||||
$Reinforcer = $database->getVillageField($defenders['from'],"owner");
|
$Reinforcer = $database->getVillageField($defenders['from'],"owner");
|
||||||
$heroarraydefender = $this->getBattleHero($Reinforcer);
|
$heroarraydefender = $this->getBattleHero($Reinforcer);
|
||||||
$_result=mysqli_query($GLOBALS['link'],"select * from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $heroarraydefender['heroid']);
|
$_result=mysqli_query($GLOBALS['link'],"select heroid, health from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $heroarraydefender['heroid']);
|
||||||
$fdb = mysqli_fetch_array($_result);
|
$fdb = mysqli_fetch_array($_result);
|
||||||
$hero_id=(int) $fdb['heroid'];
|
$hero_id=(int) $fdb['heroid'];
|
||||||
$hero_health=$fdb['health'];
|
$hero_health=$fdb['health'];
|
||||||
|
|||||||
+3
-3
@@ -371,10 +371,10 @@ if (!isset($SAJAX_INCLUDED)) {
|
|||||||
global $session,$database;
|
global $session,$database;
|
||||||
|
|
||||||
$alliance = $database->escape($session->alliance);
|
$alliance = $database->escape($session->alliance);
|
||||||
$query = mysqli_query($GLOBALS['link'],"select * from ".TB_PREFIX."chat where alli='$alliance' order by id desc limit 0,13");
|
$query = mysqli_query($GLOBALS['link'],"select id_user, name, date, msg from ".TB_PREFIX."chat where alli='$alliance' order by id desc limit 0,13");
|
||||||
while ($r = mysqli_fetch_array($query)) {
|
while ($r = mysqli_fetch_array($query)) {
|
||||||
$dates = date("g:i",$r[date]);
|
$dates = date("g:i",$r['date']);
|
||||||
$data .= "[{$dates}] <a href='spieler.php?uid={$r['id_user']}'>{$r['name']}</a>: {$r[msg]} <br>";
|
$data .= "[{$dates}] <a href='spieler.php?uid={$r['id_user']}'>{$r['name']}</a>: {$r['msg']} <br>";
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
#################################################################################
|
|
||||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
|
||||||
## --------------------------------------------------------------------------- ##
|
|
||||||
## Filename unitdata.php ##
|
|
||||||
## Developed by: Akakori ##
|
|
||||||
## License: TravianX Project ##
|
|
||||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
|
||||||
## ##
|
|
||||||
#################################################################################
|
|
||||||
$getheroinfo = mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."hero WHERE `uid`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
|
||||||
$heroinfo = mysqli_fetch_array($getheroinfo);
|
|
||||||
echo $heroinfo['attackpower'];
|
|
||||||
$hero=array('atk'=>40*$heroinfo['attackpower'],'di'=>35,'dc'=>50,'wood'=>120,'clay'=>100,'iron'=>150,'crop'=>30,'pop'=>6,'speed'=>6,'time'=>1600,'cap'=>0);
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
- oasis attack does not return troops
|
||||||
- shouldn't we create accounts from middle towards corners, not middle-corners-everywhere?
|
- 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 "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
|
||||||
|
|||||||
Reference in New Issue
Block a user