mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Remove some unused code and some fix
Remove some unused code and some fix
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename addTroops.php ##
|
||||
## Developed by: Dzoki & Advocatie ##
|
||||
## License: TravianX Project ##
|
||||
## Thanks to: Dzoki & itay2277 (edit troops) ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
|
||||
include_once("../../Account.php");
|
||||
include_once("../../Technology.php");
|
||||
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
$id = (int) $_POST['id'];
|
||||
$village = $database->getVillage($id);
|
||||
$user = $database->getUserArray($village['owner'],1);
|
||||
$coor = $database->getCoor($village['wref']);
|
||||
$varray = $database->getProfileVillages($village['owner']);
|
||||
$type = $database->getVillageType($village['wref']);
|
||||
$fdata = $database->getResourceLevel($village['wref']);
|
||||
$units = $database->getUnit($village['wref']);
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
$_POST[$key] = (int) $value;
|
||||
}
|
||||
|
||||
for($i = 1; $i <= 50; $i++) ${"u".$i} = $_POST['u'.$i];
|
||||
|
||||
if($user['tribe'] == 1){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u1 = $u1, u2 = $u2, u3 = $u3, u4 = $u4, u5 = $u5, u6 = $u6, u7 = $u7, u8 = $u8, u9 = $u9, u10 = $u10 WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 2){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u11 = '$u11', u12 = '$u12', u13 = '$u13', u14 = '$u14', u15 = '$u15', u16 = '$u16', u17 = '$u17', u18 = '$u18', u19 = '$u19', u20 = '$u20' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 3){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u21 = '$u21', u22 = '$u22', u23 = '$u23', u24 = '$u24', u25 = '$u25', u26 = '$u26', u27 = '$u27', u28 = '$u28', u29 = '$u29', u30 = '$u30' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 4){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u31 = '$u31', u32 = '$u32', u33 = '$u33', u34 = '$u34', u35 = '$u35', u36 = '$u36', u37 = '$u37', u38 = '$u38', u39 = '$u39', u40 = '$u40' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
} else if($user['tribe'] == 5){
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u41 = '$u41', u42 = '$u42', u43 = '$u43', u44 = '$u44', u45 = '$u45', u46 = '$u46', u47 = '$u47', u48 = '$u48', u49 = '$u49', u50 = '$u50' WHERE vref = $id";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
}
|
||||
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed troop anmount in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
|
||||
|
||||
$database->addStarvationData($village['wref']);
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=addTroops&did=".$id."&d");
|
||||
|
||||
?>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename gold.php ##
|
||||
## Developed by: Dzoki ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
include_once("../../Account.php");
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
$id = (int) $_POST['id'];
|
||||
$admid = (int) $_POST['admid'];
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET cp = cp + ".$_POST['cp']." WHERE id = ".$id."");
|
||||
|
||||
$name = $database->getUserField($id,"username",0);
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$admid,'Added ".$_POST['cp']." Cultural Points to user <a href=\'admin.php?p=player&uid=$id\'>$name</a> ',".time().")");
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."&cp=ok");
|
||||
?>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename medals.php ##
|
||||
## Developed by: aggenkeech ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
#################################################################################
|
||||
|
||||
include_once("../../Account.php");
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
|
||||
|
||||
$deleteweek = (int) $_POST['medalweek'];
|
||||
mysqli_query($GLOBALS["link"], "DELETE FROM ".TB_PREFIX."medal WHERE week = ".$deleteweek."");
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=delmedal");
|
||||
?>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename editUser.php ##
|
||||
## Developed by: Dzoki ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
include_once("../../Account.php");
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
$_POST[$key] = $database->escape($value);
|
||||
}
|
||||
|
||||
$id = $_POST['id'];
|
||||
$user = $database->getUserArray($id,1);
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET email = '".$_POST['email']."', tribe = ".(int) $_POST['tribe'].", location = '".$_POST['location']."', desc1 = '".$_POST['desc1']."', desc2 = '".$_POST['desc2']."' WHERE id = ".(int) $_POST['id']."");
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed <a href=\'admin.php?p=village&did=$id\'>".$user['username']."</a>\'s profile',".time().")");
|
||||
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."");
|
||||
?>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename gold.php ##
|
||||
## Developed by: Dzoki ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
include_once("../../Account.php");
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
$id = (int) $_POST['id'];
|
||||
$gold = (int) $_POST['gold'];
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."users SET gold = gold + ".$gold." WHERE id != '0'";
|
||||
mysqli_query($GLOBALS["link"], $q);
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$gold</b> gold to all users',".time().")");
|
||||
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=gold&g");
|
||||
?>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename gold_1.php ##
|
||||
## Developed by: Dzoki ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
include_once("../../Account.php");
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
$id = $_POST['id'];
|
||||
$admid = (int) $_POST['admid'];
|
||||
mysqli_query($GLOBALS["link"], "UPDATE ".TB_PREFIX."users SET gold = gold + ".(int) $_POST['gold']." WHERE id = ".(int) $id."");
|
||||
|
||||
$name = $database->getUserField($id,"username",0);
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$admid,'Added <b>".(int) $_POST['gold']."</b> gold to user <a href=\'admin.php?p=player&uid=$id\'>$name</a> ',".time().")");
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id."&g=ok");
|
||||
?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename 404.tpl ##
|
||||
## Developed by: aggenkeech ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
?>
|
||||
<div style="margin-top: 50px;">
|
||||
<div style="text-align: center">
|
||||
<h1>404 - File not found</h1>
|
||||
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
|
||||
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
|
||||
<p>This system is not complete yet. So the page probably does not exist.</p><br>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename medals.php ##
|
||||
## Developed by: aggenkeech ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
#################################################################################
|
||||
|
||||
include_once("../../Account.php");
|
||||
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
$medalid = (int) $_POST['medalid'];
|
||||
$uid = (int) $_POST['uid'];
|
||||
$admid = (int) $_POST['admid'];
|
||||
|
||||
mysqli_query($GLOBALS["link"], "DELETE FROM ".TB_PREFIX."medal WHERE id = ".$medalid."");
|
||||
|
||||
$name = mysqli_query($GLOBALS["link"], "SELECT name FROM ".TB_PREFIX."users WHERE id= ".$uid."");
|
||||
$name = mysqli_result($name, 0);
|
||||
|
||||
mysqli_query($GLOBALS["link"], "Insert into ".TB_PREFIX."admin_log values (0,$admid,'Deleted medal id [#".$medalid."] from the user <a href=\'admin.php?p=player&uid=$uid\'>$name</a> ',".time().")");
|
||||
|
||||
|
||||
$deleteweek = (int) $_POST['medalweek'];
|
||||
mysqli_query($GLOBALS["link"], "DELETE FROM ".TB_PREFIX."medal WHERE week = ".$deleteweek."");
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$uid."");
|
||||
?>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename renameVillage.php ##
|
||||
## Developed by: aggenkeech ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
#################################################################################
|
||||
|
||||
include_once("../../Account.php");
|
||||
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
$origname = $_POST['villagename'];
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
$_POST[$key] = $database->escape($value);
|
||||
}
|
||||
|
||||
$did = (int) $_POST['did'];
|
||||
$name = $_POST['villagename'];
|
||||
$sql = "UPDATE ".TB_PREFIX."vdata SET name = '$name' WHERE wref = $did";
|
||||
|
||||
mysqli_query($GLOBALS["link"], $sql);
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=village&did=".$did."&name=".$origname."");
|
||||
?>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename sendMessage.php ##
|
||||
## Developed by: aggenkeech ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
#################################################################################
|
||||
include_once("../../GameEngine/Account.php");
|
||||
if (!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
$_POST[$key] = $database->escape($value);
|
||||
}
|
||||
|
||||
$uid = (int) $_POST['uid'];
|
||||
$topic = $_POST['topic'];
|
||||
$message = $_POST['message'];
|
||||
$time = time();
|
||||
|
||||
$query = "INSERT INTO ".TB_PREFIX."mdata SET target = $uid, owner = 1, topic = '$topic', message = '$message', viewed = 0, archived = 0, send = 0, time = $time, deltarget = 0, delowner = 0, alliance = 0, player = 0, coor = 0, report = 0";
|
||||
mysqli_query($GLOBALS["link"], $query) OR DIE (mysqli_errno($GLOBALS["link"]));
|
||||
|
||||
header("Location: ../../../Admin/admin.php?p=Newmessage&uid=".$uid."&msg=ok");
|
||||
?>
|
||||
@@ -392,18 +392,6 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
|
||||
<td><?php echo EDIT_NEWSBOX3 ?> <em class="tooltip">?<span class="classic"><?php echo EDIT_NEWSBOX3_TOOLTIP ?></span></em></td>
|
||||
<td><?php if(NEWSBOX3){ echo "<b><font color='Green'>Enabled</font></b>"; } elseif(!NEWSBOX3){ echo "<b><font color='Red'>Disabled</font></b>"; } ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!--<td>Home 1</td>
|
||||
<td><?php if(HOME1){ echo "<b><font color='Green'>Enabled</font></b>"; } else if(HOME1 == false){ echo "<b><font color='Red'>Disabled</font></b>"; } ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Home 2</td>
|
||||
<td><?php if(HOME2){ echo "<b><font color='Green'>Enabled</font></b>"; } else if(HOME2 == false){ echo "<b><font color='Red'>Disabled</font></b>"; } ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Home 3</td>
|
||||
<td><?php if(HOME3){ echo "<b><font color='Green'>Enabled</font></b>"; } else if(HOME3 == false){ echo "<b><font color='Red'>Disabled</font></b>"; } ?> </td>
|
||||
</tr>-->
|
||||
</table>
|
||||
|
||||
<table id="member">
|
||||
|
||||
+6
-7
@@ -6,14 +6,14 @@
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## ##
|
||||
## Project: TravianZ ##
|
||||
## Version: 05.03.2014 ##
|
||||
## Version: 05.03.2026 ##
|
||||
## Filename: Admin/admin.php ##
|
||||
## Developed by: Dzoki ##
|
||||
## Edited by: Shadow and ronix ##
|
||||
## License: Creative Commons BY-NC-SA 3.0 ##
|
||||
## Copyright: TravianZ (c) 2014 - All rights reserved ##
|
||||
## URLs: http://travian.shadowss.ro ##
|
||||
## Source code: https://github.com/Shadowss/TravianZ ##
|
||||
## Refactored by: Shadow ##
|
||||
## License: TravianZ Project ##
|
||||
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||
## URLs: https://travianz.org ##
|
||||
## https://github.com/Shadowss/TravianZ ##
|
||||
## ##
|
||||
#################################################################################
|
||||
|
||||
@@ -507,7 +507,6 @@ if (!empty($_GET['p'])) {
|
||||
<li><a href="<?php echo HOMEPAGE; ?>">Server Homepage</a></li>
|
||||
<li><a href="index.php">Control Panel Home</a></li>
|
||||
<li><a href="<?php echo rtrim(SERVER, '/'); ?>/dorf1.php">Return to the server</a></li>
|
||||
<!--<li><a href="?p=update"><font color="Red"><b>Server Update (<?php echo $up_avl; ?>)</b></font></a></li>-->
|
||||
<li><a href="?action=logout">Logout</a></li>
|
||||
<li class="sub"><a href="#">Server Info</a>
|
||||
<ul>
|
||||
|
||||
@@ -146,7 +146,7 @@ class adm_DB {
|
||||
$dataarray = $$name;
|
||||
|
||||
for ($i = 1; $i <= $lvl; $i++) {
|
||||
$popT += $dataarray[$i]['pop'];
|
||||
$popT += $dataarray[$i]['pop'] ?? 0;
|
||||
}
|
||||
return $popT;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ class adm_DB {
|
||||
$dataarray = $$name;
|
||||
|
||||
for ($i = 1; $i <= $lvl; $i++) {
|
||||
$popT += $dataarray[$i]['cp'];
|
||||
$popT += $dataarray[$i]['cp'] ?? 0;
|
||||
}
|
||||
return $popT;
|
||||
}
|
||||
|
||||
+168
-524
@@ -606,7 +606,7 @@ class Automation {
|
||||
|
||||
$vilIDs = [];
|
||||
foreach($dataarray as $data) {
|
||||
$vilIDs[$data['to']] = true;
|
||||
$vilIDs[$data['wid']] = true;
|
||||
$vilIDs[$data['from']] = true;
|
||||
}
|
||||
$vilIDs = array_keys($vilIDs);
|
||||
@@ -935,6 +935,8 @@ class Automation {
|
||||
// calculate battles
|
||||
foreach($dataarray as $data) {
|
||||
//set base things
|
||||
$totaltraped_att = 0;
|
||||
for($i = 1; $i <= 11; $i++) ${'traped'.$i} = 0;
|
||||
$isoasis = $data['oasistype'];
|
||||
$AttackArrivalTime = $data['endtime'];
|
||||
$AttackerWref = $data['from'];
|
||||
@@ -4210,531 +4212,173 @@ WHERE
|
||||
*
|
||||
*/
|
||||
|
||||
function medals(){
|
||||
global $ranking, $database;
|
||||
|
||||
//we may give away ribbons
|
||||
$giveMedal = false;
|
||||
$q = "SELECT lastgavemedal FROM ".TB_PREFIX."config";
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
if($result) {
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$stime = strtotime(START_DATE) - strtotime(date('d.m.Y')) + strtotime(START_TIME);
|
||||
if($row['lastgavemedal'] == 0 && $stime < time()){
|
||||
$setDays = round(MEDALINTERVAL / 86400);
|
||||
$newtime = $setDays < 7 ? strtotime(($setDays + 1).'day midnight') : strtotime('next monday');
|
||||
$q = "UPDATE ".TB_PREFIX."config SET lastgavemedal = ".(int) $newtime;
|
||||
$database->query($q);
|
||||
}elseif($row['lastgavemedal'] != 0){
|
||||
$time = $row['lastgavemedal'] + MEDALINTERVAL;
|
||||
$giveMedal = $row['lastgavemedal'] < time();
|
||||
}
|
||||
}
|
||||
|
||||
if($giveMedal && MEDALINTERVAL > 0){
|
||||
|
||||
//determine which week we are
|
||||
|
||||
$q = "SELECT week FROM ".TB_PREFIX."medal order by week DESC LIMIT 0, 1";
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
if(mysqli_num_rows($result)) {
|
||||
$row=mysqli_fetch_assoc($result);
|
||||
$week=($row['week']+1);
|
||||
} else {
|
||||
$week='1';
|
||||
}
|
||||
|
||||
//Do same for ally week
|
||||
|
||||
$q = "SELECT week FROM ".TB_PREFIX."allimedal order by week DESC LIMIT 0, 1";
|
||||
$result = mysqli_query($database->dblink,$q);
|
||||
if(mysqli_num_rows($result)) {
|
||||
$row=mysqli_fetch_assoc($result);
|
||||
$allyweek=($row['week']+1);
|
||||
} else {
|
||||
$allyweek='1';
|
||||
}
|
||||
|
||||
|
||||
//Attackers of the week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, ap FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY ap DESC, id DESC Limit 10");
|
||||
$i=0;
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
$i++;
|
||||
$img="t2_".($i)."";
|
||||
$quer="insert into ".TB_PREFIX."medal (userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", 1, ".($i).", ".(int) $week.", '".$row['ap']."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Defender of the week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, dp FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY dp DESC, id DESC Limit 10");
|
||||
$i=0;
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
$i++;
|
||||
$img="t3_".($i)."";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '2', ".($i).", '".(int) $week."', '".$row['dp']."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Climbers of the week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, Rc FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY Rc DESC, id DESC Limit 10");
|
||||
$i=0;
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
$i++;
|
||||
$img="t1_".($i)."";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '3', ".($i).", '".(int) $week."', '".$row['Rc']."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Rank climbers of the week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, clp FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY clp DESC Limit 10");
|
||||
$i=0;
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
$i++;
|
||||
$img="t6_".($i)."";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '10', ".($i).", '".(int) $week."', '".$row['clp']."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Robbers of the week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, RR FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY RR DESC, id DESC Limit 10");
|
||||
$i=0;
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
$i++;
|
||||
$img="t4_".($i)."";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '4', ".($i).", '".(int) $week."', '".$row['RR']."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Part of the bonus for top 10 attack + defense out
|
||||
//Top10 attackers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY ap DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
//Top 10 defenders
|
||||
$result2 = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY dp DESC, id DESC Limit 10");
|
||||
while($row2 = mysqli_fetch_array($result2)){
|
||||
if($row['id']==$row2['id']){
|
||||
|
||||
$query3="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 5";
|
||||
$result3=mysqli_query($database->dblink,$query3);
|
||||
$row3=mysqli_fetch_row($result3);
|
||||
|
||||
//Look what color the ribbon must have
|
||||
if($row3[0]<='2'){
|
||||
$img="t22".$row3[0]."_1";
|
||||
switch ($row3[0]) {
|
||||
case "0":
|
||||
$tekst="";
|
||||
break;
|
||||
case "1":
|
||||
$tekst="twice ";
|
||||
break;
|
||||
case "2":
|
||||
$tekst="three times ";
|
||||
break;
|
||||
}
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '5', '0', '".(int) $week."', '".$tekst."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//you stand for 3rd / 5th / 10th time in the top 3 strikers
|
||||
//top10 attackers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY ap DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 1 AND plaats<=3";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x at present as it is so ribbon 3rd (bronze)
|
||||
if($row1[0]=='3'){
|
||||
$img="t120_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '6', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x at present as it is so 5th medal (silver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t121_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '6', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t122_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '6', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
}
|
||||
//you stand for 3rd / 5th / 10th time in the top 10 attackers
|
||||
//top10 attackers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY ap DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 1 AND plaats<=10";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t130_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '12', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t131_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '12', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t132_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '12', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
}
|
||||
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
|
||||
//Pak de top10 verdedigers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY dp DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 2 AND plaats<=3";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t140_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '7', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t141_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '7', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t142_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '7', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
}
|
||||
//je staat voor 3e / 5e / 10e keer in de top 3 verdedigers
|
||||
//Pak de top10 verdedigers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY dp DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 2 AND plaats<=10";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t150_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '13', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t151_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '13', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t152_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '13', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
||||
//Pak de top10 klimmers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY Rc DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 3 AND plaats<=3";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t100_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '8', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t101_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '8', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t102_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '8', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
||||
//Pak de top10 klimmers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY Rc DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 3 AND plaats<=10";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t110_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '14', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t111_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '14', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t112_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '14', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
|
||||
//je staat voor 3e / 5e / 10e keer in de top 3 klimmers
|
||||
//Pak de top3 rank climbers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY clp DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 10 AND plaats<=3";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t200_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '11', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t201_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '11', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t202_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '11', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
//je staat voor 3e / 5e / 10e keer in de top 10klimmers
|
||||
//Pak de top3 rank climbers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY clp DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 10 AND plaats<=10";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t210_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '16', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t211_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '16', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t212_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '16', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
|
||||
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
|
||||
//Pak de top10 overvallers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY RR DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 4 AND plaats<=3";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t160_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '9', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t161_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '9', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t162_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '9', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
//je staat voor 3e / 5e / 10e keer in de top 10 overvallers
|
||||
//Pak de top10 overvallers
|
||||
$result = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY RR DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
$query1="SELECT Count(*) FROM ".TB_PREFIX."medal WHERE userid=".(int) $row['id']." AND categorie = 4 AND plaats<=10";
|
||||
$result1=mysqli_query($database->dblink,$query1);
|
||||
$row1=mysqli_fetch_row($result1);
|
||||
|
||||
|
||||
//2x in gestaan, dit is 3e dus lintje (brons)
|
||||
if($row1[0]=='3'){
|
||||
$img="t170_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '15', '0', '".(int) $week."', 'Three', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//4x in gestaan, dit is 5e dus lintje (zilver)
|
||||
if($row1[0]=='5'){
|
||||
$img="t171_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '15', '0', '".(int) $week."', 'Five', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
//9x at present as it is so 10th medal (gold)
|
||||
if($row1[0]=='10'){
|
||||
$img="t172_1";
|
||||
$quer="insert into ".TB_PREFIX."medal(userid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '15', '0', '".(int) $week."', 'Ten', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
|
||||
//Put all true dens to 0
|
||||
$query="SELECT id FROM ".TB_PREFIX."users WHERE id > 5 AND access < 8 ORDER BY id+0 DESC";
|
||||
$result=mysqli_query($database->dblink,$query);
|
||||
$userIDs = [];
|
||||
for ($i=0; $row=mysqli_fetch_row($result); $i++){
|
||||
$userIDs[] = (int) $row[0];
|
||||
}
|
||||
|
||||
if (count($userIDs)) {
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users SET ap=0, dp=0,Rc=0,clp=0, RR=0 WHERE id IN(".implode(', ', $userIDs).")");
|
||||
}
|
||||
|
||||
//Start alliance Medals wooot
|
||||
|
||||
//Aanvallers v/d Week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, ap FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
|
||||
$i=0; while($row = mysqli_fetch_array($result)){
|
||||
$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."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Verdediger v/d Week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, dp FROM ".TB_PREFIX."alidata ORDER BY dp DESC Limit 10");
|
||||
$i=0; while($row = mysqli_fetch_array($result)){
|
||||
$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."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Overvallers v/d Week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, RR FROM ".TB_PREFIX."alidata ORDER BY RR DESC, id DESC Limit 10");
|
||||
$i=0; while($row = mysqli_fetch_array($result)){
|
||||
$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."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
//Rank climbers of the week
|
||||
$result = mysqli_query($database->dblink,"SELECT id, clp FROM ".TB_PREFIX."alidata ORDER BY clp DESC Limit 10");
|
||||
$i=0; while($row = mysqli_fetch_array($result)){
|
||||
$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."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
|
||||
$result = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC Limit 10");
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
|
||||
//Pak de top10 verdedigers
|
||||
$result2 = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."alidata ORDER BY dp DESC, id DESC Limit 10");
|
||||
while($row2 = mysqli_fetch_array($result2)){
|
||||
if($row['id']==$row2['id']){
|
||||
|
||||
$query3="SELECT Count(*) FROM ".TB_PREFIX."allimedal WHERE allyid=".(int) $row['id']." AND categorie = 5";
|
||||
$result3=mysqli_query($database->dblink,$query3);
|
||||
$row3=mysqli_fetch_row($result3);
|
||||
|
||||
//Look what color the ribbon must have
|
||||
if($row3[0]<='2'){
|
||||
$img="t22".$row3[0]."_1";
|
||||
switch ($row3[0]) {
|
||||
case "0":
|
||||
$tekst="";
|
||||
break;
|
||||
case "1":
|
||||
$tekst="twice ";
|
||||
break;
|
||||
case "2":
|
||||
$tekst="three times ";
|
||||
break;
|
||||
}
|
||||
$quer="insert into ".TB_PREFIX."allimedal(allyid, categorie, plaats, week, points, img) values(".(int) $row['id'].", '5', '0', '".$allyweek."', '".$tekst."', '".$img."')";
|
||||
$resul=mysqli_query($database->dblink,$quer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query="SELECT id FROM ".TB_PREFIX."alidata ORDER BY id+0 DESC";
|
||||
$result=mysqli_query($database->dblink,$query);
|
||||
|
||||
$aliIDs = [];
|
||||
for ($i=0; $row=mysqli_fetch_row($result); $i++){
|
||||
$aliIDs[] = (int) $row[0];
|
||||
}
|
||||
|
||||
if (count($aliIDs)) {
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."alidata SET ap=0, dp=0,RR=0,clp=0 WHERE id IN(".implode(', ', $aliIDs).")");
|
||||
}
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."config SET lastgavemedal=".$time;
|
||||
$database->query($q);
|
||||
function medals() {
|
||||
global $ranking, $database;
|
||||
|
||||
// --- Configuration ---
|
||||
$minUid = 5;
|
||||
// Exclude BANNED (0), MH (8), ADMIN (9)
|
||||
$userFilter = "id > $minUid AND access NOT IN (0,8,9)";
|
||||
|
||||
// Helper to insert a user medal
|
||||
$insertMedal = function($userid, $category, $place, $week, $points, $img) use ($database) {
|
||||
$q = "INSERT INTO ".TB_PREFIX."medal (userid, categorie, plaats, week, points, img) VALUES (".
|
||||
(int)$userid.", ".(int)$category.", ".(int)$place.", ".(int)$week.", '".mysqli_real_escape_string($database->dblink, $points)."', '".mysqli_real_escape_string($database->dblink, $img)."')";
|
||||
mysqli_query($database->dblink, $q);
|
||||
};
|
||||
|
||||
// --- Check if we should award medals now ---
|
||||
$giveMedal = false;
|
||||
$q = "SELECT lastgavemedal FROM ".TB_PREFIX."config";
|
||||
$result = mysqli_query($database->dblink, $q);
|
||||
if ($result) {
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$stime = strtotime(START_DATE) - strtotime(date('d.m.Y')) + strtotime(START_TIME);
|
||||
|
||||
if ($row['lastgavemedal'] == 0 && $stime < time()) {
|
||||
// First run after server start - schedule next run
|
||||
$setDays = round(MEDALINTERVAL / 86400);
|
||||
$newtime = $setDays < 7? strtotime(($setDays + 1).' day midnight') : strtotime('next monday');
|
||||
$database->query("UPDATE ".TB_PREFIX."config SET lastgavemedal = ".(int)$newtime);
|
||||
} elseif ($row['lastgavemedal']!= 0) {
|
||||
$time = $row['lastgavemedal'] + MEDALINTERVAL;
|
||||
$giveMedal = $row['lastgavemedal'] < time();
|
||||
}
|
||||
}
|
||||
|
||||
if (!($giveMedal && MEDALINTERVAL > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// --- Determine current week numbers ---
|
||||
$getNextWeek = function($table) use ($database) {
|
||||
$q = "SELECT week FROM ".TB_PREFIX."$table ORDER BY week DESC LIMIT 1";
|
||||
$res = mysqli_query($database->dblink, $q);
|
||||
return $res && mysqli_num_rows($res)? (mysqli_fetch_assoc($res)['week'] + 1) : 1;
|
||||
};
|
||||
$week = $getNextWeek('medal');
|
||||
$allyweek = $getNextWeek('allimedal');
|
||||
|
||||
// --- Award top 10 for each category ---
|
||||
$awardTop = function($field, $category, $imgPrefix) use ($database, $userFilter, $week, $insertMedal) {
|
||||
$q = "SELECT id, $field FROM ".TB_PREFIX."users WHERE $userFilter ORDER BY $field DESC, id DESC LIMIT 10";
|
||||
$res = mysqli_query($database->dblink, $q);
|
||||
$i = 0;
|
||||
while ($row = mysqli_fetch_array($res)) {
|
||||
$i++;
|
||||
$insertMedal($row['id'], $category, $i, $week, $row[$field], $imgPrefix.$i);
|
||||
}
|
||||
};
|
||||
|
||||
// Attackers of the week (cat 1)
|
||||
$awardTop('ap', 1, 't2_');
|
||||
// Defenders of the week (cat 2)
|
||||
$awardTop('dp', 2, 't3_');
|
||||
// Climbers of the week (cat 3)
|
||||
$awardTop('Rc', 3, 't1_');
|
||||
// Rank climbers of the week (cat 10)
|
||||
$awardTop('clp', 10, 't6_');
|
||||
// Robbers of the week (cat 4)
|
||||
$awardTop('RR', 4, 't4_');
|
||||
|
||||
// --- Bonus: player in both top10 attack AND defense (cat 5) ---
|
||||
$topAttackers = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."users WHERE $userFilter ORDER BY ap DESC, id DESC LIMIT 10");
|
||||
while ($a = mysqli_fetch_array($topAttackers)) {
|
||||
$topDefenders = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."users WHERE $userFilter ORDER BY dp DESC, id DESC LIMIT 10");
|
||||
while ($d = mysqli_fetch_array($topDefenders)) {
|
||||
if ($a['id'] == $d['id']) {
|
||||
$cnt = mysqli_fetch_row(mysqli_query($database->dblink, "SELECT COUNT(*) FROM ".TB_PREFIX."medal WHERE userid=".(int)$a['id']." AND categorie=5"))[0];
|
||||
if ($cnt <= 2) {
|
||||
$texts = [0 => '', 1 => 'twice ', 2 => 'three times '];
|
||||
$insertMedal($a['id'], 5, 0, $week, $texts[$cnt], 't22'.$cnt.'_1');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Milestone ribbons for 3/5/10 times in top3 or top10 ---
|
||||
$awardMilestone = function($field, $sourceCat, $topLimit, $targetCat, $imgBase) use ($database, $userFilter, $week, $insertMedal) {
|
||||
$res = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."users WHERE $userFilter ORDER BY $field DESC, id DESC LIMIT 10");
|
||||
while ($u = mysqli_fetch_array($res)) {
|
||||
$cnt = mysqli_fetch_row(mysqli_query($database->dblink,
|
||||
"SELECT COUNT(*) FROM ".TB_PREFIX."medal WHERE userid=".(int)$u['id']." AND categorie=".(int)$sourceCat." AND plaats<=".(int)$topLimit))[0];
|
||||
|
||||
$map = ['3' => ['Three', $imgBase.'0_1'], '5' => ['Five', $imgBase.'1_1'], '10' => ['Ten', $imgBase.'2_1']];
|
||||
if (isset($map[$cnt])) {
|
||||
$insertMedal($u['id'], $targetCat, 0, $week, $map[$cnt][0], $map[$cnt][1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Attackers milestones
|
||||
$awardMilestone('ap', 1, 3, 6, 't12'); // top3 attackers
|
||||
$awardMilestone('ap', 1, 10, 12, 't13'); // top10 attackers
|
||||
// Defenders milestones
|
||||
$awardMilestone('dp', 2, 3, 7, 't14');
|
||||
$awardMilestone('dp', 2, 10, 13, 't15');
|
||||
// Climbers milestones
|
||||
$awardMilestone('Rc', 3, 3, 8, 't10');
|
||||
$awardMilestone('Rc', 3, 10, 14, 't11');
|
||||
// Rank climbers milestones
|
||||
$awardMilestone('clp', 10, 3, 11, 't20');
|
||||
$awardMilestone('clp', 10, 10, 16, 't21');
|
||||
// Robbers milestones
|
||||
$awardMilestone('RR', 4, 3, 9, 't16');
|
||||
$awardMilestone('RR', 4, 10, 15, 't17');
|
||||
|
||||
// --- Reset weekly stats for eligible users ---
|
||||
$ids = [];
|
||||
$res = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."users WHERE $userFilter");
|
||||
while ($r = mysqli_fetch_row($res)) { $ids[] = (int)$r[0]; }
|
||||
if ($ids) {
|
||||
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."users SET ap=0, dp=0, Rc=0, clp=0, RR=0 WHERE id IN(".implode(',', $ids).")");
|
||||
}
|
||||
|
||||
// --- Alliance medals (no user filter needed) ---
|
||||
$insertAlly = function($allyid, $cat, $place, $week, $points, $img) use ($database) {
|
||||
$q = "INSERT INTO ".TB_PREFIX."allimedal (allyid, categorie, plaats, week, points, img) VALUES (".(int)$allyid.", '".(int)$cat."', ".(int)$place.", '".(int)$week."', '".mysqli_real_escape_string($database->dblink, $points)."', '".mysqli_real_escape_string($database->dblink, $img)."')";
|
||||
mysqli_query($database->dblink, $q);
|
||||
};
|
||||
|
||||
$allyCats = [
|
||||
['ap', 1, 'a2_'],
|
||||
['dp', 2, 'a3_'],
|
||||
['RR', 4, 'a4_'],
|
||||
['clp', 3, 'a1_']
|
||||
];
|
||||
foreach ($allyCats as [$field, $cat, $img]) {
|
||||
$res = mysqli_query($database->dblink, "SELECT id, $field FROM ".TB_PREFIX."alidata ORDER BY $field DESC, id DESC LIMIT 10");
|
||||
$i = 0;
|
||||
while ($r = mysqli_fetch_array($res)) { $i++; $insertAlly($r['id'], $cat, $i, $allyweek, $r[$field], $img.$i); }
|
||||
}
|
||||
|
||||
// Alliance bonus for attack+defense
|
||||
$resA = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."alidata ORDER BY ap DESC, id DESC LIMIT 10");
|
||||
while ($a = mysqli_fetch_array($resA)) {
|
||||
$resD = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."alidata ORDER BY dp DESC, id DESC LIMIT 10");
|
||||
while ($d = mysqli_fetch_array($resD)) {
|
||||
if ($a['id'] == $d['id']) {
|
||||
$cnt = mysqli_fetch_row(mysqli_query($database->dblink, "SELECT COUNT(*) FROM ".TB_PREFIX."allimedal WHERE allyid=".(int)$a['id']." AND categorie=5"))[0];
|
||||
if ($cnt <= 2) {
|
||||
$texts = [0 => '', 1 => 'twice ', 2 => 'three times '];
|
||||
$insertAlly($a['id'], 5, 0, $allyweek, $texts[$cnt], 't22'.$cnt.'_1');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reset alliance stats
|
||||
$aliIds = [];
|
||||
$res = mysqli_query($database->dblink, "SELECT id FROM ".TB_PREFIX."alidata");
|
||||
while ($r = mysqli_fetch_row($res)) { $aliIds[] = (int)$r[0]; }
|
||||
if ($aliIds) {
|
||||
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."alidata SET ap=0, dp=0, RR=0, clp=0 WHERE id IN(".implode(',', $aliIds).")");
|
||||
}
|
||||
|
||||
// --- Update last awarded time ---
|
||||
$database->query("UPDATE ".TB_PREFIX."config SET lastgavemedal=".(int)$time);
|
||||
}
|
||||
|
||||
private function artefactOfTheFool() {
|
||||
global $database;
|
||||
|
||||
@@ -4777,4 +4421,4 @@ $automation = new Automation;
|
||||
|
||||
// remove automation lock file
|
||||
@unlink( AUTOMATION_LOCK_FILE_NAME );
|
||||
?>
|
||||
?>
|
||||
|
||||
+30
-30
@@ -8286,25 +8286,25 @@ $q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
|
||||
$result = $result[0];
|
||||
}
|
||||
self::$prisonersCache[$wid[0].$mode] = (count($result) ? [$result] : []);
|
||||
} else {
|
||||
if ($result && count($result)) {
|
||||
if (!isset(self::$prisonersCache[$record[($mode ? 'from' : 'wref')].$mode])) {
|
||||
self::$prisonersCache[$record[($mode ? 'from' : 'wref' )].$mode] = [];
|
||||
}
|
||||
|
||||
foreach ($result as $record) {
|
||||
self::$prisonersCache[$record[($mode ? 'from' : 'wref')].$mode][] = $record;
|
||||
}
|
||||
}
|
||||
|
||||
// check for any missing IDs and fill them in with blanks,
|
||||
// since no reinforcements were found for these villages
|
||||
foreach ($wid as $key) {
|
||||
if (!isset(self::$prisonersCache[$key.$mode])) {
|
||||
self::$prisonersCache[$key.$mode] = [];
|
||||
}
|
||||
} else {
|
||||
if ($result && count($result)) {
|
||||
foreach ($result as $record) {
|
||||
$key = $record[($mode ? 'from' : 'wref')] . $mode;
|
||||
if (!isset(self::$prisonersCache[$key])) {
|
||||
self::$prisonersCache[$key] = [];
|
||||
}
|
||||
self::$prisonersCache[$key][] = $record;
|
||||
}
|
||||
}
|
||||
|
||||
// check for any missing IDs and fill them in with blanks,
|
||||
// since no prisoners were found for these villages
|
||||
foreach ($wid as $key) {
|
||||
if (!isset(self::$prisonersCache[$key.$mode])) {
|
||||
self::$prisonersCache[$key.$mode] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ($array_passed ? self::$prisonersCache : self::$prisonersCache[$wid[0].$mode]);
|
||||
}
|
||||
@@ -8342,19 +8342,19 @@ $q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
|
||||
}
|
||||
|
||||
function getPrisoners3($from, $use_cache = true) {
|
||||
list($from) = $this->escape_input((int) $from);
|
||||
|
||||
// first of all, check if we should be using cache and whether the field
|
||||
// required is already cached
|
||||
if ($use_cache && ($cachedValue = self::returnCachedContent(self::$prisonersCacheByVillageAndFromIDs, $from)) && !is_null($cachedValue)) {
|
||||
return $cachedValue;
|
||||
}
|
||||
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "prisoners where " . TB_PREFIX . "prisoners.from = $from";
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
|
||||
self::$prisonersCacheByVillageAndFromIDs[$wid.$from] = $this->mysqli_fetch_all($result);
|
||||
return self::$prisonersCacheByVillageAndFromIDs[$from];
|
||||
list($from) = $this->escape_input((int) $from);
|
||||
|
||||
// first of all, check if we should be using cache and whether the field
|
||||
// required is already cached
|
||||
if ($use_cache && ($cachedValue = self::returnCachedContent(self::$prisonersCacheByVillageAndFromIDs, $from)) && !is_null($cachedValue)) {
|
||||
return $cachedValue;
|
||||
}
|
||||
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "prisoners where " . TB_PREFIX . "prisoners.from = $from";
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
|
||||
self::$prisonersCacheByVillageAndFromIDs[$from] = $this->mysqli_fetch_all($result); // FIX: scos $wid
|
||||
return self::$prisonersCacheByVillageAndFromIDs[$from];
|
||||
}
|
||||
|
||||
function deletePrisoners($id) {
|
||||
|
||||
@@ -63,7 +63,7 @@ include_once("Profile.php");
|
||||
class Session {
|
||||
|
||||
private $time;
|
||||
|
||||
private $populated = false;
|
||||
var $logged_in = false;
|
||||
var $referrer, $url;
|
||||
var $username, $uid, $access, $plus, $tribe, $isAdmin, $alliance, $gold, $oldrank, $gpack, $goldclub;
|
||||
@@ -83,7 +83,10 @@ class Session {
|
||||
private $userarray = [];
|
||||
|
||||
var $villages = [];
|
||||
|
||||
var $sit;
|
||||
var $sit1;
|
||||
var $sit2;
|
||||
var $cp;
|
||||
function __construct() {
|
||||
global $database;
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class Technology {
|
||||
array_push($listarray,$train);
|
||||
}
|
||||
if($type == 8 && in_array($train['unit'],$trapper)) {
|
||||
$train['name'] = $this->unarray[$train['unit']];
|
||||
$train['name'] = $this->unarray[$train['unit']]?? 'Trap';
|
||||
array_push($listarray,$train);
|
||||
}
|
||||
}
|
||||
@@ -512,7 +512,7 @@ class Technology {
|
||||
if($this->maxUnit($unit, $great) < $amt) $amt = 0;
|
||||
}else{
|
||||
$trainlist = $this->getTrainingList(8);
|
||||
|
||||
$train_amt = 0;
|
||||
foreach($trainlist as $train) $train_amt += $train['amt'];
|
||||
|
||||
$max = 0;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
## ##
|
||||
## License: TravianZ Project ##
|
||||
## Copyright: TravianZ (c) 2010-2026. All rights reserved. ##
|
||||
## URLs: https://travianz.org ##
|
||||
## https://github.com/Shadowss/TravianZ ##
|
||||
## URLs: https://travianz.org ##
|
||||
## https://github.com/Shadowss/TravianZ ##
|
||||
## ##
|
||||
#################################################################################
|
||||
|
||||
@@ -150,6 +150,7 @@ class Units {
|
||||
if($post['c'] < 2 || $post['c'] > 4) return "Invalid attack type.";
|
||||
|
||||
//check if at least one troops has been selected
|
||||
$selectedTroops = 0;
|
||||
for($i = 1; $i <= 11; $i++) $selectedTroops += empty($post['t'.$i]) ? 0 : $post['t'.$i];
|
||||
if($selectedTroops == 0) return "You need to select min. one troop";
|
||||
|
||||
@@ -266,9 +267,9 @@ class Units {
|
||||
}
|
||||
}
|
||||
|
||||
if($data['u11'] > $village->unitarray['hero']) $form->addError("error", "You can't send more units than you have");
|
||||
if($data['u11'] < 0) $form->addError("error", "You can't send negative units.");
|
||||
if($data['type'] != 1 && $post['spy'] != 0) $post['spy'] = 0;
|
||||
if($data['u11'] > $village->unitarray['hero']) $form->addError("error", "You can't send more units than you have");
|
||||
if($data['u11'] < 0) $form->addError("error", "You can't send negative units.");
|
||||
if($data['type'] != 1) $post['spy'] = 0; else $post['spy'] = $post['spy']?? 0;
|
||||
|
||||
if($form->returnErrors() > 0){
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
|
||||
@@ -29,7 +29,12 @@ class Village {
|
||||
public $wid, $vname, $capital, $natar, $master;
|
||||
public $resarray = [];
|
||||
public $unitarray, $techarray, $unitall, $researching, $abarray = [];
|
||||
|
||||
public $enforcetome = [];
|
||||
public $enforcetoyou = [];
|
||||
public $enforceoasis = [];
|
||||
public $currentcel = 0;
|
||||
public $allcrop = 0;
|
||||
public $loyalty = 0;
|
||||
private $infoarray = [];
|
||||
private $production = [];
|
||||
private $oasisowned, $ocounter = [];
|
||||
|
||||
+15
-13
@@ -244,9 +244,9 @@ while ($donnees = mysqli_fetch_assoc($result2)) {
|
||||
|
||||
$sessionAlliance = (int)$session->alliance;
|
||||
|
||||
$allyCache = $database->getAllianceAlly($sessionAlliance, 1);
|
||||
$warCache = $database->getAllianceWar2($sessionAlliance);
|
||||
$neutralCache = $database->getAllianceAlly($sessionAlliance, 2);
|
||||
$allyCache = $database->getAllianceAlly($sessionAlliance, 1)?: [];
|
||||
$warCache = $database->getAllianceWar2($sessionAlliance)?: [];
|
||||
$neutralCache = $database->getAllianceAlly($sessionAlliance, 2)?: [];
|
||||
|
||||
$target = (int)$donnees["aliance_id"];
|
||||
|
||||
@@ -254,17 +254,19 @@ while ($donnees = mysqli_fetch_assoc($result2)) {
|
||||
RELATION STATUS
|
||||
========================= */
|
||||
|
||||
$friend = ($target && $sessionAlliance) ? (
|
||||
($allyCache[0]['alli1'] == $target || $allyCache[0]['alli2'] == $target)
|
||||
) : 0;
|
||||
$friend = $war = $neutral = 0;
|
||||
|
||||
$war = ($target && $sessionAlliance) ? (
|
||||
($warCache[0]['alli1'] == $target || $warCache[0]['alli2'] == $target)
|
||||
) : 0;
|
||||
|
||||
$neutral = ($target && $sessionAlliance) ? (
|
||||
($neutralCache[0]['alli1'] == $target || $neutralCache[0]['alli2'] == $target)
|
||||
) : 0;
|
||||
if ($target && $sessionAlliance) {
|
||||
foreach ($allyCache as $ac) {
|
||||
if ((($ac['alli1']?? 0) == $target) || (($ac['alli2']?? 0) == $target)) { $friend = 1; break; }
|
||||
}
|
||||
foreach ($warCache as $wc) {
|
||||
if ((($wc['alli1']?? 0) == $target) || (($wc['alli2']?? 0) == $target)) { $war = 1; break; }
|
||||
}
|
||||
foreach ($neutralCache as $nc) {
|
||||
if ((($nc['alli1']?? 0) == $target) || (($nc['alli2']?? 0) == $target)) { $neutral = 1; break; }
|
||||
}
|
||||
}
|
||||
|
||||
/* =========================
|
||||
IMAGE DECISION (UNCHANGED)
|
||||
|
||||
@@ -384,9 +384,9 @@ while ($donnees = mysqli_fetch_assoc($result2)) {
|
||||
|
||||
$sessionAlliance = (int)$session->alliance;
|
||||
|
||||
$allyCache = $database->getAllianceAlly($sessionAlliance, 1);
|
||||
$warCache = $database->getAllianceWar2($sessionAlliance);
|
||||
$neutralCache = $database->getAllianceAlly($sessionAlliance, 2);
|
||||
$allyCache = $database->getAllianceAlly($sessionAlliance, 1)?: [];
|
||||
$warCache = $database->getAllianceWar2($sessionAlliance)?: [];
|
||||
$neutralCache = $database->getAllianceAlly($sessionAlliance, 2)?: [];
|
||||
|
||||
$target = (int)$donnees["aliance_id"];
|
||||
|
||||
@@ -394,18 +394,19 @@ while ($donnees = mysqli_fetch_assoc($result2)) {
|
||||
RELATION STATUS
|
||||
========================= */
|
||||
|
||||
$friend = ($target && $sessionAlliance) ? (
|
||||
($allyCache[0]['alli1'] == $target || $allyCache[0]['alli2'] == $target)
|
||||
) : 0;
|
||||
|
||||
$war = ($target && $sessionAlliance) ? (
|
||||
($warCache[0]['alli1'] == $target || $warCache[0]['alli2'] == $target)
|
||||
) : 0;
|
||||
|
||||
$neutral = ($target && $sessionAlliance) ? (
|
||||
($neutralCache[0]['alli1'] == $target || $neutralCache[0]['alli2'] == $target)
|
||||
) : 0;
|
||||
$friend = $war = $neutral = 0;
|
||||
|
||||
if ($target && $sessionAlliance) {
|
||||
foreach ($allyCache as $ac) {
|
||||
if ((($ac['alli1']?? 0) == $target) || (($ac['alli2']?? 0) == $target)) { $friend = 1; break; }
|
||||
}
|
||||
foreach ($warCache as $wc) {
|
||||
if ((($wc['alli1']?? 0) == $target) || (($wc['alli2']?? 0) == $target)) { $war = 1; break; }
|
||||
}
|
||||
foreach ($neutralCache as $nc) {
|
||||
if ((($nc['alli1']?? 0) == $target) || (($nc['alli2']?? 0) == $target)) { $neutral = 1; break; }
|
||||
}
|
||||
}
|
||||
|
||||
/* =========================
|
||||
IMAGE DECISION
|
||||
|
||||
@@ -13,7 +13,7 @@ $ckey = $generator->generateRandStr(6);
|
||||
if (!isset($process['t10']) || $process['t10'] == ''){ $t10 = 0; }else{ $t10 = $process['t10']; }
|
||||
if (!isset($process['t11']) || $process['t11'] == ''){ $t11 = 0; }else{ $t11 = $process['t11']; $showhero=1; }
|
||||
|
||||
|
||||
$totalunits = 0;
|
||||
for($i = 1; $i <= 11; $i++){
|
||||
$totalunits += (($i != 3 && $session->tribe == 3) ||
|
||||
($i != 4 && $session->tribe != 3)) ? (!empty($process['t'.$i]) ? $process['t'.$i] : 0) : 0;
|
||||
|
||||
Reference in New Issue
Block a user