refactor: most of broad SELECTs updated

Closes #301
This commit is contained in:
Martin Ambrus
2017-11-05 14:35:19 +01:00
parent ee285a4ed8
commit ee017adb40
34 changed files with 95 additions and 101 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ $total_for2 = count($send);
for($y=0;$y < $total_for;$y++){
for($i=0;$i < $total_for2;$i++){
if($units[$y]['ref'] == $send[$i]['ref2']){
$res1 = mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PREFIX . "send where id = ".(int) $send[$i]['ref']."");
$res1 = mysqli_query($GLOBALS['link'],"SELECT wood, clay, iron, crop FROM " . TB_PREFIX . "send where id = ".(int) $send[$i]['ref']."");
$res = mysqli_fetch_array($res1);
}
}
+3 -3
View File
@@ -6,10 +6,10 @@ if(time() - (!empty($_SESSION['time_p']) ? $_SESSION['time_p'] : 0) > 5) {
if($_POST AND $_GET['action'] == 'change_capital') {
$pass = mysqli_escape_string($GLOBALS['link'],$_POST['pass']);
$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . (int) $session->uid);
$query = mysqli_query($GLOBALS['link'],'SELECT password FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . (int) $session->uid);
$data = mysqli_fetch_assoc($query);
if(password_verify($pass, $data['password'])) {
$query1 = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' .(int) $session->uid . ' AND `capital` = 1');
$query1 = mysqli_query($GLOBALS['link'],'SELECT wref FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' .(int) $session->uid . ' AND `capital` = 1');
$data1 = mysqli_fetch_assoc($query1);
$query2 = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'fdata` WHERE `vref` = ' . (int) $data1['wref']);
$data2 = mysqli_fetch_assoc($query2);
@@ -67,7 +67,7 @@ else{
?>
<?php
$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' . (int) $session->uid . ' AND `capital` = 1');
$query = mysqli_query($GLOBALS['link'],'SELECT wref FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' . (int) $session->uid . ' AND `capital` = 1');
$data = mysqli_fetch_assoc($query);
if($data['wref'] == $village->wid) {
?>
+2 -2
View File
@@ -103,10 +103,10 @@ if($count == 0) {
unset($reqlvl);
unset($effect);
$arts = mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PREFIX . "artefacts");
$arts = mysqli_query($GLOBALS['link'],"SELECT type, vref, id, name, size, owner, effect FROM " . TB_PREFIX . "artefacts");
$rows = array();
while($row = mysqli_fetch_array($arts)) {
$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'wdata` WHERE `id` = ' . (int) $row['vref']);
$query = mysqli_query($GLOBALS['link'],'SELECT x, y FROM `' . TB_PREFIX . 'wdata` WHERE `id` = ' . (int) $row['vref']);
$coor2 = mysqli_fetch_assoc($query);
+9 -9
View File
@@ -38,7 +38,7 @@
} else {
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 1");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 1");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -58,7 +58,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 2");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 2");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -78,7 +78,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 3");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 3");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -98,7 +98,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 4");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 4");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -117,7 +117,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 5");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 5");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -136,7 +136,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 6");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 6");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -155,7 +155,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 7");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 7");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -174,7 +174,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 8");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 8");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -188,7 +188,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 8");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 8");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
+15 -15
View File
@@ -37,7 +37,7 @@
echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
} else {
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 1");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 1");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -51,7 +51,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 1");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 1");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -71,7 +71,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 2");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 2");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -85,7 +85,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 2");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 2");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -105,7 +105,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 3");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 3");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -119,7 +119,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 3");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 3");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -139,7 +139,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 4");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 4");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -153,7 +153,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 4");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 4");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -172,7 +172,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 5");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 5");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -186,7 +186,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 5");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 5");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -205,7 +205,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 6");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 6");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -219,7 +219,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 6");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 6");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -238,7 +238,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 7");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 7");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -252,7 +252,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 7");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 7");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
@@ -271,7 +271,7 @@
unset($artefact);
unset($row);
$artefact = mysqli_query($GLOBALS['link'],"SELECT * FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 8");
$artefact = mysqli_query($GLOBALS['link'],"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 3 AND type = 8");
while($row = mysqli_fetch_array($artefact)) {
echo '<tr>';
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
+2 -2
View File
@@ -164,7 +164,7 @@ $user = $session->uid;
//loop search village user
$query = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."vdata WHERE owner = ".(int) $user."");
$query = mysqli_query($GLOBALS['link'],"SELECT wref FROM ".TB_PREFIX."vdata WHERE owner = ".(int) $user."");
while($villaggi_array = mysqli_fetch_array($query)){
//loop structure village
@@ -288,7 +288,7 @@ $user = $session->uid;
//mysqli_select_db(SQL_DB);
//loop search village user
$query = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."vdata WHERE owner = ".(int) $user."");
$query = mysqli_query($GLOBALS['link'],"SELECT wref FROM ".TB_PREFIX."vdata WHERE owner = ".(int) $user."");
while($villaggi_array = mysqli_fetch_array($query)){
//loop structure village
+7 -7
View File
@@ -2,7 +2,7 @@
<?php
$basearray = $database->getMInfo($_GET['d']);
$uinfo = $database->getVillage($basearray['id']);
$oasis1 = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'odata` WHERE `wref` = ' . mysqli_real_escape_string($GLOBALS['link'],$_GET['d']));
$oasis1 = mysqli_query($GLOBALS['link'],'SELECT conqured, owner FROM `' . TB_PREFIX . 'odata` WHERE `wref` = ' . mysqli_real_escape_string($GLOBALS['link'],$_GET['d']));
$oasis = mysqli_fetch_assoc($oasis1);
$access=$session->access;
$oasislink = '';
@@ -167,7 +167,7 @@ if($session->uid == $database->getVillage($_GET['d'])){
}
$toWref = $_GET['d'];
if($session->alliance!=0){
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE $limit AND ally = ".$session->alliance." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$result = mysqli_query($GLOBALS['link'],"SELECT data, ntype, id, topic, time FROM ".TB_PREFIX."ndata WHERE $limit AND ally = ".$session->alliance." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$query = mysqli_num_rows($result);
if($query != 0){
while($row = mysqli_fetch_array($result)){
@@ -191,7 +191,7 @@ if($type==18 or $type==19 or $type==20 or $type==21){
<?php }
}else{
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE uid = ".$session->uid." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$result = mysqli_query($GLOBALS['link'],"SELECT data, ntype, id, topic, time FROM ".TB_PREFIX."ndata WHERE uid = ".$session->uid." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$query = mysqli_num_rows($result);
if($query != 0){
while($row = mysqli_fetch_array($result)){
@@ -266,7 +266,7 @@ if($session->uid == $database->getVillage($_GET['d'])){
}
$toWref = $_GET['d'];
if($session->alliance!=0){
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE $limit AND ally = ".$session->alliance." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$result = mysqli_query($GLOBALS['link'],"SELECT data, ntype, id, topic, time FROM ".TB_PREFIX."ndata WHERE $limit AND ally = ".$session->alliance." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$query = mysqli_num_rows($result);
if($query != 0){
while($row = mysqli_fetch_array($result)){
@@ -290,7 +290,7 @@ if($type==18 or $type==19 or $type==20 or $type==21){
<?php }
}else{
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE uid = ".$session->uid." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$result = mysqli_query($GLOBALS['link'],"SELECT data, ntype, id, topic, time FROM ".TB_PREFIX."ndata WHERE uid = ".$session->uid." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$query = mysqli_num_rows($result);
if($query != 0){
while($row = mysqli_fetch_array($result)){
@@ -392,7 +392,7 @@ if($session->uid == $database->getVillage($_GET['d'])){
}
$toWref = $_GET['d'];
if($session->alliance!=0){
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE $limit AND ally = ".$session->alliance." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$result = mysqli_query($GLOBALS['link'],"SELECT data, ntype, id, topic, time FROM ".TB_PREFIX."ndata WHERE $limit AND ally = ".$session->alliance." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$query = mysqli_num_rows($result);
if($query != 0){
while($row = mysqli_fetch_array($result)){
@@ -416,7 +416,7 @@ if($type==18 or $type==19 or $type==20 or $type==21 or $type==22){
<?php }
}else{
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE $limit AND uid = ".$session->uid." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$result = mysqli_query($GLOBALS['link'],"SELECT data, ntype, id, topic, time FROM ".TB_PREFIX."ndata WHERE $limit AND uid = ".$session->uid." AND toWref = ".$toWref." ORDER BY time DESC Limit 5");
$query = mysqli_num_rows($result);
if($query != 0){
while($row = mysqli_fetch_array($result)){
+1 -1
View File
@@ -11,7 +11,7 @@
<th class="sent">Sent</th>
</tr></thead><tfoot><tr><th>
<?php
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".(int) $session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT plus FROM ".TB_PREFIX."users WHERE `id`='".(int) $session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
$date2=strtotime("NOW");
if ($golds['plus'] <= $date2) { ?>
+1 -1
View File
@@ -22,7 +22,7 @@
<th>Recipient</th>
<th class="sent"><a href="nachrichten.php?t=2&s=0&amp;t=2&amp;o=1">Sent</a></th>
</tr></thead><tfoot><tr><th><?php
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".(int) $session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT plus FROM ".TB_PREFIX."users WHERE `id`='".(int) $session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
$date2=strtotime("NOW");
if ($golds['plus'] <= $date2) { ?>
+1 -1
View File
@@ -2,7 +2,7 @@
<?php
$online = mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE timestamp > ".(time() - (60*10))." AND tribe!=0 AND tribe!=4 AND tribe!=5");
$top_rank = mysqli_fetch_assoc(mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE ".(INCLUDE_ADMIN ? '' : 'access< 8 AND ')."id > 5 AND tribe<=3 AND tribe > 0 ORDER BY oldrank ASC Limit 1"));
$top_rank = mysqli_fetch_assoc(mysqli_query($GLOBALS['link'],"SELECT username FROM ".TB_PREFIX."users WHERE ".(INCLUDE_ADMIN ? '' : 'access< 8 AND ')."id > 5 AND tribe<=3 AND tribe > 0 ORDER BY oldrank ASC Limit 1"));
?>
+1 -1
View File
@@ -12,7 +12,7 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att
</tr>
</thead><tfoot>
<tr><th><?php
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".(int) $session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT plus FROM ".TB_PREFIX."users WHERE `id`='".(int) $session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
$date2=strtotime("NOW");
if ($golds['plus'] <= $date2) { ?>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
////////////// made by alq0rsan, improved by evader /////////////////////////
if($session->access != BANNED && $session->gold >= 5){
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT gold, b2 FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
if($session->sit == 0) {
if (mysqli_num_rows($MyGold) == 1) {
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
////////////// made by alq0rsan, improved by evader /////////////////////////
if($session->access != BANNED && $session->gold >= 5){
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT gold, b3 FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
if($session->sit == 0) {
if (mysqli_num_rows($MyGold)) {
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
////////////// made by alq0rsan, improved by evader /////////////////////////
if($session->access != BANNED && $session->gold >= 5){
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT gold, b4 FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
if($session->sit == 0) {
if (mysqli_num_rows($MyGold)) {
-3
View File
@@ -1,9 +1,6 @@
<?php
////////////// made by alq0rsan /////////////////////////
if($session->access != BANNED){
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
$MyVilId = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."vdata WHERE `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
$uuVilid = mysqli_fetch_array($MyVilId);
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
////////////// made by alq0rsan, improved by evader /////////////////////////
if($session->access != BANNED && $session->gold >= 10){
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT gold, plus FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
if($session->sit == 0) {
if (mysqli_num_rows($MyGold) == 1) {
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
////////////// made by alq0rsan, improved by evader /////////////////////////
if($session->access != BANNED && $session->gold >= 5){
$MyGold = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$MyGold = mysqli_query($GLOBALS['link'],"SELECT gold, b1 FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$golds = mysqli_fetch_array($MyGold);
if($session->sit == 0) {
if (mysqli_num_rows($MyGold) == 1) {
+2 -3
View File
@@ -50,8 +50,8 @@ EOT;
$plusTime = 604800; // 7 days
$time = time();
$giveplus = ($time + $plustime);
$accountCheck = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
if(mysqli_num_rows($accountCheck) <= 0){
$accountCheck = mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'"), MYSQLI_ASSOC) or die(mysqli_error($database->dblink));
if($accountCheck['Total'] <= 0){
echo "<b>ERROR:</b><br />";
echo "The account name you entered does not exist.";
echo "<br /><br /><input type=\"button\" value=\"Back\" onclick=\"history.go(-1)\">";
@@ -59,7 +59,6 @@ EOT;
}
if(!$valid) break;
$valid=TRUE;
$acc = mysqli_fetch_array($accountCheck);
$plusCheck = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
$pluss = mysqli_fetch_array($plusCheck);
+2 -2
View File
@@ -60,7 +60,7 @@ if($_POST) {
}
} elseif(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) != '') {
// Update link
$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
$query = mysqli_query($GLOBALS['link'],'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
$data = mysqli_fetch_assoc($query);
// May the user update this entry?
@@ -69,7 +69,7 @@ if($_POST) {
}
} elseif(trim($link['nr']) == '' AND trim($link['linkname']) == '' AND trim($link['linkziel']) == '' AND trim($link['id']) != '') {
// Delete entry
$query = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
$query = mysqli_query($GLOBALS['link'],'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
$data = mysqli_fetch_assoc($query);
// May the user delete this entry?
+1 -1
View File
@@ -380,7 +380,7 @@ $end = ($tribe*10);
else
{
//$uid
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $uid." AND dead = 0";
$q = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $uid." AND dead = 0";
$result = mysqli_query($GLOBALS['link'],$q);
$hero_f=mysqli_fetch_array($result);
$hero_unit=$hero_f['unit'];
+1 -1
View File
@@ -137,7 +137,7 @@ $tocoor = $database->getCoor($enforce['vref']);
}
}
if ($enforce['hero']>0){
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$resulth = mysqli_query($GLOBALS['link'],$qh);
$hero_f=mysqli_fetch_array($resulth);
$hero_unit=$hero_f['unit'];
+1 -1
View File
@@ -138,7 +138,7 @@ $tocoor = $database->getCoor($enforce['vref']);
}
}
if ($enforce['hero']>0){
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$resulth = mysqli_query($GLOBALS['link'],$qh);
$hero_f=mysqli_fetch_array($resulth);
$hero_unit=$hero_f['unit'];
+1 -1
View File
@@ -137,7 +137,7 @@ $tocoor = $database->getCoor($enforce['vref']);
}
}
if ($enforce['hero']>0){
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$resulth = mysqli_query($GLOBALS['link'],$qh);
$hero_f=mysqli_fetch_array($resulth);
$hero_unit=$hero_f['unit'];
+1 -1
View File
@@ -138,7 +138,7 @@ $tocoor = $database->getCoor($enforce['vref']);
}
}
if ($enforce['hero']>0){
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$resulth = mysqli_query($GLOBALS['link'],$qh);
$hero_f=mysqli_fetch_array($resulth);
$hero_unit=$hero_f['unit'];
+1 -1
View File
@@ -137,7 +137,7 @@ $tocoor = $database->getCoor($enforce['vref']);
}
}
if ($enforce['hero']>0){
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $to['owner']." AND dead = 0";
$resulth = mysqli_query($GLOBALS['link'],$qh);
$hero_f=mysqli_fetch_array($resulth);
$hero_unit=$hero_f['unit'];
+1 -1
View File
@@ -4,7 +4,7 @@
$lid = $_POST['lid'];
$tribe = $_POST['tribe'];
$getFLData = $database->getFLData($lid);
$sql = "SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = ".$database->escape((int) $lid)." order by id asc";
$sql = "SELECT id, towref, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 FROM ".TB_PREFIX."raidlist WHERE lid = ".$database->escape((int) $lid)." order by id asc";
$array = $database->query_return($sql);
foreach($array as $row){
$sql1 = mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."units WHERE vref = ".(int) $getFLData['wref']));
+3 -3
View File
@@ -9,7 +9,7 @@ if(isset($_GET['t'])==99 && isset($_POST['action'])=='addList' && $_POST['did']!
exit;
}
$sql = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY wref DESC");
$sql = mysqli_query($GLOBALS['link'],"SELECT id, name, owner, wref FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY wref DESC");
$query = mysqli_num_rows($sql);
while($row = mysqli_fetch_array($sql)){
$lid = $row["id"];
@@ -193,7 +193,7 @@ $vdata = $database->getVillage($towref);
<?php
$noticeClass = array("Scout Report","Won as attacker without losses","Won as attacker with losses","Lost as attacker with losses","Won as defender without losses","Won as defender with losses","Lost as defender with losses","Lost as defender without losses","Reinforcement arrived","","Wood Delivered","Clay Delivered","Iron Delivered","Crop Delivered","","Won as defender without losses","Won as defender with losses","Lost as defender with losses","Won scouting as attacker","Lost scouting as attacker","Won scouting as defender","Lost scouting as defender");
$limits = "(ntype=1 or ntype=2 or ntype=3 or ntype=18 or ntype=19 or ntype=22)";
$getnotice = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."ndata WHERE $limits AND toWref = ".(int) $towref." AND uid = ".(int) $session->uid." ORDER BY time DESC Limit 1");
$getnotice = mysqli_query($GLOBALS['link'],"SELECT ntype, data, time, id FROM ".TB_PREFIX."ndata WHERE $limits AND toWref = ".(int) $towref." AND uid = ".(int) $session->uid." ORDER BY time DESC Limit 1");
if(mysqli_num_rows($getnotice) > 0){
while($row2 = mysqli_fetch_array($getnotice)){
$dataarray = explode(",",$row2['data']);
@@ -316,7 +316,7 @@ if(!$database->getVilFarmlist($village->wid)){
{
Travian.Game.RaidList.setData({
<?php
$result = mysqli_query($GLOBALS['link'],'SELECT * FROM '.TB_PREFIX.'farmlist WHERE wref = '.(int) $village->wid.'');
$result = mysqli_query($GLOBALS['link'],'SELECT id FROM '.TB_PREFIX.'farmlist WHERE wref = '.(int) $village->wid.'');
$query1 = mysqli_num_rows($result);
$NUM1 = 1;
while($row = mysqli_fetch_array($result)){
+2 -2
View File
@@ -86,7 +86,7 @@ $vdata = $database->getVillage($Wref);
<select name="lid">
<?php
$sql = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY name ASC");
$sql = mysqli_query($GLOBALS['link'],"SELECT id, name, owner, wref FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY name ASC");
while($row = mysqli_fetch_array($sql)){
$lid = $row["id"];
$lname = $row["name"];
@@ -121,7 +121,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
<label class="lastTargets">Last targets:</label>
<select name="target_id">
<?php
$getwref = "SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = ".$database->escape((int) $_GET['lid'])."";
$getwref = "SELECT towref FROM ".TB_PREFIX."raidlist WHERE lid = ".$database->escape((int) $_GET['lid'])."";
$arraywref = $database->query_return($getwref);
echo '<option value="">Select village</option>';
if(mysqli_num_rows(mysqli_query($GLOBALS['link'],$getwref)) != 0){
+2 -2
View File
@@ -93,7 +93,7 @@ $lid2 = $getlid['lid'];
<td>
<select onchange="getTargetsByLid();" id="lid" name="lid">
<?php
$sql = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY name ASC");
$sql = mysqli_query($GLOBALS['link'],"SELECT id, name, owner, wref FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY name ASC");
while($row = mysqli_fetch_array($sql)){
$lid = $row["id"];
$lname = $row["name"];
@@ -127,7 +127,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
<label class="lastTargets">Last targets:</label>
<select name="target_id">
<?php
$getwref = "SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = ".(int) $lid2;
$getwref = "SELECT id, towref FROM ".TB_PREFIX."raidlist WHERE lid = ".(int) $lid2;
$arraywref = $database->query_return($getwref);
echo '<option value="">Select village</option>';
if(mysqli_num_rows(mysqli_query($GLOBALS['link'],$getwref)) != 0){