mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-06 21:04:20 +00:00
General fixes
+Removed almost all "BANNED" controls to template and .php UI files. The control will be done only once and in the Session class
This commit is contained in:
+62
-118
@@ -221,7 +221,7 @@ class Alliance {
|
||||
*****************************************/
|
||||
public function sendInvite($post) {
|
||||
global $form, $database, $session;
|
||||
if($session->access != BANNED){
|
||||
|
||||
$UserData = $database->getUserArray(stripslashes($post['a_name']), 0);
|
||||
if($this->userPermArray['opt4'] == 0) {
|
||||
$form->addError("name", NO_PERMISSION);
|
||||
@@ -257,10 +257,6 @@ class Alliance {
|
||||
0,
|
||||
true);
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@@ -268,19 +264,15 @@ class Alliance {
|
||||
*****************************************/
|
||||
private function rejectInvite($get) {
|
||||
global $database, $session;
|
||||
if($session->access != BANNED){
|
||||
|
||||
foreach($this->inviteArray as $invite) {
|
||||
if($invite['id'] == $get['d'] && $invite['uid'] == $session->uid) {
|
||||
$database->removeInvitation($get['d']);
|
||||
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has rejected the invitation.');
|
||||
}
|
||||
}
|
||||
header("Location: build.php?gid=18");
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
header("Location: build.php?gid=18");
|
||||
exit;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@@ -288,7 +280,7 @@ class Alliance {
|
||||
*****************************************/
|
||||
private function delInvite($get) {
|
||||
global $database, $session;
|
||||
if($session->access != BANNED){
|
||||
|
||||
$inviteArray = $database->getAliInvitations($session->alliance);
|
||||
foreach($inviteArray as $invite) {
|
||||
if($invite['id'] == $get['d'] && $invite['alliance'] == $session->alliance && $this->userPermArray['opt4'] == 1) {
|
||||
@@ -297,12 +289,8 @@ class Alliance {
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has deleted the invitation for <a href="spieler.php?uid='.$invitename['id'].'">'.addslashes($invitename['username']).'</a>.');
|
||||
}
|
||||
}
|
||||
header("Location: allianz.php?delinvite");
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
header("Location: allianz.php?delinvite");
|
||||
exit;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@@ -311,34 +299,29 @@ class Alliance {
|
||||
private function acceptInvite($get) {
|
||||
global $form, $database, $session;
|
||||
|
||||
if ($session->access != BANNED) {
|
||||
foreach ($this->inviteArray as $invite) {
|
||||
if ($session->alliance == 0) {
|
||||
if ($invite['id'] == $get['d'] && $invite['uid'] == $session->uid) {
|
||||
$memberlist = $database->getAllMember($invite['alliance']);
|
||||
$alliance_info = $database->getAlliance($invite['alliance']);
|
||||
if (count($memberlist) < $alliance_info['max']) {
|
||||
$database->removeInvitation($get['d']);
|
||||
$database->updateUserField($invite['uid'], "alliance", $invite['alliance'], 1);
|
||||
$database->createAlliPermissions($invite['uid'], $invite['alliance'], '', 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
// Log the notice
|
||||
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has joined the alliance.');
|
||||
} else {
|
||||
$accept_error = 1;
|
||||
$max = $alliance_info['max'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($accept_error == 1){
|
||||
$form->addError("ally_accept", "The alliance can contain only ".$max." members at this moment.");
|
||||
}else{
|
||||
header("Location: build.php?gid=18");
|
||||
exit;
|
||||
}
|
||||
} else{
|
||||
header("Location: banned.php");
|
||||
foreach ($this->inviteArray as $invite) {
|
||||
if ($session->alliance == 0) {
|
||||
if ($invite['id'] == $get['d'] && $invite['uid'] == $session->uid) {
|
||||
$memberlist = $database->getAllMember($invite['alliance']);
|
||||
$alliance_info = $database->getAlliance($invite['alliance']);
|
||||
if (count($memberlist) < $alliance_info['max']) {
|
||||
$database->removeInvitation($get['d']);
|
||||
$database->updateUserField($invite['uid'], "alliance", $invite['alliance'], 1);
|
||||
$database->createAlliPermissions($invite['uid'], $invite['alliance'], '', 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
// Log the notice
|
||||
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has joined the alliance.');
|
||||
} else {
|
||||
$accept_error = 1;
|
||||
$max = $alliance_info['max'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($accept_error == 1) $form->addError("ally_accept", "The alliance can contain only ".$max." members at this moment.");
|
||||
else
|
||||
{
|
||||
header("Location: build.php?gid=18");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -348,7 +331,7 @@ class Alliance {
|
||||
*****************************************/
|
||||
private function createAlliance($post) {
|
||||
global $form, $database, $session, $bid18, $building;
|
||||
if($session->access != BANNED){
|
||||
|
||||
if(!isset($post['ally1']) || $post['ally1'] == "") {
|
||||
$form->addError("ally1", ATAG_EMPTY);
|
||||
}
|
||||
@@ -385,10 +368,6 @@ class Alliance {
|
||||
header("Location: build.php?gid=18");
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@@ -397,11 +376,6 @@ class Alliance {
|
||||
private function changeAliName($get) {
|
||||
global $form, $database, $session;
|
||||
|
||||
if($session->access == BANNED) {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$userAlly = $database->getAlliance($session->alliance);
|
||||
|
||||
if(!isset($get['ally1']) || $get['ally1'] == "") $form->addError("ally1", ATAG_EMPTY);
|
||||
@@ -431,7 +405,7 @@ class Alliance {
|
||||
*****************************************/
|
||||
private function updateAlliProfile($post) {
|
||||
global $database, $session, $form;
|
||||
if($session->access != BANNED){
|
||||
|
||||
if($this->userPermArray['opt3'] == 0) {
|
||||
$form->addError("perm", NO_PERMISSION);
|
||||
}
|
||||
@@ -443,10 +417,6 @@ class Alliance {
|
||||
// log the notice
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has changed the alliance description.');
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
@@ -455,12 +425,7 @@ class Alliance {
|
||||
private function changeUserPermissions($post)
|
||||
{
|
||||
global $database, $session, $form;
|
||||
if($session->access == BANNED)
|
||||
{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if($this->userPermArray['opt1'] == 0) $form->addError("perm", NO_PERMISSION);
|
||||
elseif($database->getUserField($post['a_user'], "alliance", 0) != $session->alliance) $form->addError("perm", USER_NOT_IN_YOUR_ALLY);
|
||||
elseif($post['a_user'] == $session->uid) $form->addError("perm", CANT_EDIT_YOUR_PERMISSIONS);
|
||||
@@ -487,31 +452,26 @@ class Alliance {
|
||||
private function kickAlliUser($post) {
|
||||
global $database, $session, $form;
|
||||
|
||||
if ($session->access != BANNED) {
|
||||
$UserData = $database->getUserArray($post['a_user'], 1);
|
||||
if($this->userPermArray['opt2'] == 0) {
|
||||
$form->addError("perm", NO_PERMISSION);
|
||||
} else if($database->getUserField($post['a_user'], "alliance", 0) != $session->alliance){
|
||||
$form->addError("perm", USER_NOT_IN_YOUR_ALLY);
|
||||
} else if($UserData['id'] != $session->uid){
|
||||
$database->updateUserField($post['a_user'], 'alliance', 0, 1);
|
||||
$database->deleteAlliPermissions($post['a_user']);
|
||||
$database->deleteAlliance($session->alliance);
|
||||
// log the notice
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$UserData['id'].'">'.($kickedUsername = addslashes($database->getUserField($post['a_user'], "username", 0))).'</a> has been expelled from the alliance by <a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a>.');
|
||||
if($session->alliance && $database->isAllianceOwner($UserData['id']) == $session->alliance){
|
||||
$newowner = $database->getAllMember2($session->alliance);
|
||||
$newleader = $newowner['id'];
|
||||
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".(int) $newleader." where id = ".(int) $session->alliance."";
|
||||
$database->query($q);
|
||||
$database->updateAlliPermissions($newleader, 1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
Automation::updateMax($newleader);
|
||||
}
|
||||
$form->addError("perm", $kickedUsername.ALLY_USER_KICKED);
|
||||
}
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
$UserData = $database->getUserArray($post['a_user'], 1);
|
||||
if($this->userPermArray['opt2'] == 0) {
|
||||
$form->addError("perm", NO_PERMISSION);
|
||||
} else if($database->getUserField($post['a_user'], "alliance", 0) != $session->alliance){
|
||||
$form->addError("perm", USER_NOT_IN_YOUR_ALLY);
|
||||
} else if($UserData['id'] != $session->uid){
|
||||
$database->updateUserField($post['a_user'], 'alliance', 0, 1);
|
||||
$database->deleteAlliPermissions($post['a_user']);
|
||||
$database->deleteAlliance($session->alliance);
|
||||
// log the notice
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$UserData['id'].'">'.($kickedUsername = addslashes($database->getUserField($post['a_user'], "username", 0))).'</a> has been expelled from the alliance by <a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a>.');
|
||||
if($session->alliance && $database->isAllianceOwner($UserData['id']) == $session->alliance){
|
||||
$newowner = $database->getAllMember2($session->alliance);
|
||||
$newleader = $newowner['id'];
|
||||
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".(int) $newleader." where id = ".(int) $session->alliance."";
|
||||
$database->query($q);
|
||||
$database->updateAlliPermissions($newleader, 1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||
Automation::updateMax($newleader);
|
||||
}
|
||||
$form->addError("perm", $kickedUsername.ALLY_USER_KICKED);
|
||||
}
|
||||
}
|
||||
/*****************************************
|
||||
@@ -519,11 +479,6 @@ class Alliance {
|
||||
*****************************************/
|
||||
public function setForumLink($post) {
|
||||
global $database, $session, $form;
|
||||
if($session->access == BANNED)
|
||||
{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->userPermArray['opt5'] == 0) $form->addError("perm", NO_PERMISSION);
|
||||
else
|
||||
@@ -537,25 +492,21 @@ class Alliance {
|
||||
*****************************************/
|
||||
public function Vote($post) {
|
||||
global $database, $session;
|
||||
if($session->access != BANNED){
|
||||
if($database->checkSurvey($post['tid']) && !$database->checkVote($post['tid'], $session->uid)){
|
||||
$survey = $database->getSurvey($post['tid']);
|
||||
$text = ''.$survey['voted'].','.$session->uid.',';
|
||||
$database->Vote($post['tid'], $post['vote'], $text);
|
||||
}
|
||||
header("Location: allianz.php?s=2&fid2=".$post['fid2']."&tid=".$post['tid']);
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
|
||||
if($database->checkSurvey($post['tid']) && !$database->checkVote($post['tid'], $session->uid)){
|
||||
$survey = $database->getSurvey($post['tid']);
|
||||
$text = ''.$survey['voted'].','.$session->uid.',';
|
||||
$database->Vote($post['tid'], $post['vote'], $text);
|
||||
}
|
||||
header("Location: allianz.php?s=2&fid2=".$post['fid2']."&tid=".$post['tid']);
|
||||
exit;
|
||||
}
|
||||
/*****************************************
|
||||
Function to quit from alliance
|
||||
*****************************************/
|
||||
private function quitally($post) {
|
||||
global $database, $session, $form;
|
||||
if($session->access != BANNED){
|
||||
|
||||
if(!isset($post['pw']) || $post['pw'] == "") {
|
||||
$form->addError("pw", PW_EMPTY);
|
||||
} elseif(!password_verify($post['pw'], $session->userinfo['password'])) {
|
||||
@@ -620,18 +571,11 @@ class Alliance {
|
||||
header("Location: spieler.php?uid=".$session->uid);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function changediplomacy($post) {
|
||||
global $database, $session, $form;
|
||||
if($session->access == BANNED) {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->userPermArray['opt6'] == 1){
|
||||
if(!empty($post['a_name']) || !empty($post['dipl'])){
|
||||
$aName = $post['a_name'];
|
||||
|
||||
+117
-147
@@ -77,32 +77,27 @@ class Building {
|
||||
public function canProcess($id, $tid) {
|
||||
//add fix by ronix
|
||||
global $session, $database, $village;
|
||||
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$levels = $database->getResourceLevel($village->wid);
|
||||
|
||||
// don't allow building WW to level 51 with a waiting loop
|
||||
//Don't allow building WW to level 51 with a waiting loop
|
||||
if (!(($tid != 99 || ($tid == 99 && $this->allowWwUpgrade())))) $this->redirect($tid);
|
||||
|
||||
if (
|
||||
// check that our ID actually exists within the buildings list
|
||||
//Check that our ID actually exists within the buildings list
|
||||
isset($village->resarray['f'.$tid.'t']) &&
|
||||
// let's see if we should allow building what we want where we want to
|
||||
// (prevent building resource fields in the village
|
||||
//Let's see if we should allow building what we want where we want to
|
||||
//(Prevent building resource fields in the village
|
||||
(
|
||||
($tid >= 1 && $tid <= 18 && $id >= 1 && $id <= 4) ||
|
||||
($tid >= 19 && $id > 4)
|
||||
) &&
|
||||
// check that we're not trying to change a standing building type
|
||||
//Check that we're not trying to change a standing building type
|
||||
(
|
||||
$levels['f'.$tid.'t'] == $id ||
|
||||
$levels['f'.$tid.'t'] == 0
|
||||
) &&
|
||||
// check that we're not trying to build in the walls id
|
||||
//Check that we're not trying to build in the walls id
|
||||
(
|
||||
($tid == 40 && in_array($id, [31, 32, 33])) ||
|
||||
$tid != 40
|
||||
@@ -112,15 +107,15 @@ class Building {
|
||||
$this->redirect($tid);
|
||||
}
|
||||
|
||||
// check if the building will be built with the master builder
|
||||
//Check if the building will be built with the master builder
|
||||
if(isset($_GET['master'])){
|
||||
// if so, we have to check if it'll be built or upgraded
|
||||
//If so, we have to check if it'll be built or upgraded
|
||||
if($levels['f'.$tid.'t'] == 0)
|
||||
{
|
||||
// the building will be built, we have to check if we can build it
|
||||
//The building will be built, we have to check if we can build it
|
||||
if(!$this->meetRequirement($id)) $this->redirect($tid);
|
||||
}else{
|
||||
// the building will be upgraded, we have to check if we can upgrade it
|
||||
//The building will be upgraded, we have to check if we can upgrade it
|
||||
if($this->isMax($id, $tid, $this->isLoop($tid) + $this->isCurrent($tid))){
|
||||
$this->redirect($tid);
|
||||
}
|
||||
@@ -146,11 +141,6 @@ class Building {
|
||||
|
||||
public function procBuild($get) {
|
||||
global $session, $village, $database;
|
||||
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) {
|
||||
if($get['a'] == 0) $this->removeBuilding($get['d']);
|
||||
@@ -354,11 +344,6 @@ class Building {
|
||||
private function upgradeBuilding($id) {
|
||||
global $database, $village, $session, $logging, ${'bid'.$village->resarray['f'.$id.'t']};
|
||||
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->allocated < $this->maxConcurrent) {
|
||||
$uprequire = $this->resourceRequired($id,$village->resarray['f'.$id.'t']);
|
||||
$time = time() + $uprequire['time'];
|
||||
@@ -413,11 +398,6 @@ class Building {
|
||||
private function downgradeBuilding($id) {
|
||||
global $database, $village, $session, $logging;
|
||||
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->allocated < $this->maxConcurrent) {
|
||||
$name = "bid".$village->resarray['f'.$id.'t'];
|
||||
global $$name;
|
||||
@@ -455,11 +435,6 @@ class Building {
|
||||
|
||||
private function constructBuilding($id, $tid) {
|
||||
global $database, $village, $session, $logging;
|
||||
|
||||
if($session->access == BANNED) {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->allocated < $this->maxConcurrent) {
|
||||
if($tid == 16) $id = 39;
|
||||
@@ -706,128 +681,123 @@ class Building {
|
||||
public function finishAll($redirect_url = '') {
|
||||
global $database, $session, $logging, $village, $bid18, $bid10, $bid11, $technology, $_SESSION;
|
||||
|
||||
if ($session->access != BANNED) {
|
||||
// will be true if we should decrease player's gold by 2
|
||||
// for the immediate completion action
|
||||
$countPlus2Gold = false;
|
||||
// will be true if we should decrease player's gold by 1
|
||||
// for master builder queue
|
||||
$countMasterGold = false;
|
||||
// number of jobs to finish
|
||||
$buildcount = ($this->buildArray ? count($this->buildArray) : 0);
|
||||
// will be true if the job was successfully finished
|
||||
$jobFinishSuccess = false;
|
||||
// IDs of successful jobs to delete
|
||||
$deletIDs = [];
|
||||
|
||||
foreach ($this->buildArray as $jobs) {
|
||||
if ($jobs['wid'] == $village->wid) {
|
||||
$wwvillage = $database->getResourceLevel($jobs['wid']);
|
||||
if ($wwvillage['f99t'] != 40) {
|
||||
$level = $jobs['level'];
|
||||
if ($jobs['type'] != 25 && $jobs['type'] != 26 && $jobs['type'] != 40) {
|
||||
$resource = $this->resourceRequired($jobs['field'],$jobs['type']);
|
||||
// master builder involved
|
||||
if ($jobs['master'] != 0) {
|
||||
if ($this->meetRequirement($jobs['field'])) {
|
||||
// don't allow master builder to build anything
|
||||
// if we only have 2 gold, since that would take us to -1 gold
|
||||
if ( $session->gold > 2 ) {
|
||||
$villwood = $database->getVillageField( $jobs['wid'], 'wood' );
|
||||
$villclay = $database->getVillageField( $jobs['wid'], 'clay' );
|
||||
$villiron = $database->getVillageField( $jobs['wid'], 'iron' );
|
||||
$villcrop = $database->getVillageField( $jobs['wid'], 'crop' );
|
||||
$type = $jobs['type'];
|
||||
$buildarray = $GLOBALS[ "bid" . $type ];
|
||||
$buildwood = $buildarray[ $level ]['wood'];
|
||||
$buildclay = $buildarray[ $level ]['clay'];
|
||||
$buildiron = $buildarray[ $level ]['iron'];
|
||||
$buildcrop = $buildarray[ $level ]['crop'];
|
||||
if ( $buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop ) {
|
||||
$jobFinishSuccess = true;
|
||||
$countMasterGold = true;
|
||||
$enought_res = 1;
|
||||
// we need to subtract resources for this, if another 2 jobs are active,
|
||||
// as we'd never subtract those otherwise
|
||||
if ( $buildcount > 2 ) {
|
||||
$database->setVillageField( $jobs['wid'],
|
||||
['wood', 'clay', 'iron', 'crop'],
|
||||
[( $villwood - $buildwood ), ( $villclay - $buildclay ), ( $villiron - $buildiron ), ( $villcrop - $buildcrop )]);
|
||||
}
|
||||
// will be true if we should decrease player's gold by 2
|
||||
// for the immediate completion action
|
||||
$countPlus2Gold = false;
|
||||
// will be true if we should decrease player's gold by 1
|
||||
// for master builder queue
|
||||
$countMasterGold = false;
|
||||
// number of jobs to finish
|
||||
$buildcount = ($this->buildArray ? count($this->buildArray) : 0);
|
||||
// will be true if the job was successfully finished
|
||||
$jobFinishSuccess = false;
|
||||
// IDs of successful jobs to delete
|
||||
$deletIDs = [];
|
||||
|
||||
foreach ($this->buildArray as $jobs) {
|
||||
if ($jobs['wid'] == $village->wid) {
|
||||
$wwvillage = $database->getResourceLevel($jobs['wid']);
|
||||
if ($wwvillage['f99t'] != 40) {
|
||||
$level = $jobs['level'];
|
||||
if ($jobs['type'] != 25 && $jobs['type'] != 26 && $jobs['type'] != 40) {
|
||||
$resource = $this->resourceRequired($jobs['field'],$jobs['type']);
|
||||
// master builder involved
|
||||
if ($jobs['master'] != 0) {
|
||||
if ($this->meetRequirement($jobs['field'])) {
|
||||
// don't allow master builder to build anything
|
||||
// if we only have 2 gold, since that would take us to -1 gold
|
||||
if ( $session->gold > 2 ) {
|
||||
$villwood = $database->getVillageField( $jobs['wid'], 'wood' );
|
||||
$villclay = $database->getVillageField( $jobs['wid'], 'clay' );
|
||||
$villiron = $database->getVillageField( $jobs['wid'], 'iron' );
|
||||
$villcrop = $database->getVillageField( $jobs['wid'], 'crop' );
|
||||
$type = $jobs['type'];
|
||||
$buildarray = $GLOBALS[ "bid" . $type ];
|
||||
$buildwood = $buildarray[ $level ]['wood'];
|
||||
$buildclay = $buildarray[ $level ]['clay'];
|
||||
$buildiron = $buildarray[ $level ]['iron'];
|
||||
$buildcrop = $buildarray[ $level ]['crop'];
|
||||
if ( $buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop ) {
|
||||
$jobFinishSuccess = true;
|
||||
$countMasterGold = true;
|
||||
$enought_res = 1;
|
||||
// we need to subtract resources for this, if another 2 jobs are active,
|
||||
// as we'd never subtract those otherwise
|
||||
if ( $buildcount > 2 ) {
|
||||
$database->setVillageField( $jobs['wid'],
|
||||
['wood', 'clay', 'iron', 'crop'],
|
||||
[( $villwood - $buildwood ), ( $villclay - $buildclay ), ( $villiron - $buildiron ), ( $villcrop - $buildcrop )]);
|
||||
}
|
||||
} else {
|
||||
// if we only have 2 gold, we need to cancel this job, as there will never
|
||||
// be enough gold now in our account to finish this up
|
||||
$exclude_master = true;
|
||||
$deletIDs[] = (int) $jobs['id'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// non-master builder build, we should count +2 gold for it
|
||||
$countPlus2Gold = true;
|
||||
$jobFinishSuccess = true;
|
||||
}
|
||||
|
||||
// update build level in the database
|
||||
if ($jobFinishSuccess) {
|
||||
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
|
||||
}
|
||||
|
||||
if (!isset($exclude_master) && $database->query($q) && ($enought_res == 1 || $jobs['master'] == 0)) {
|
||||
$database->modifyPop($jobs['wid'],$resource['pop'],0);
|
||||
$database->addCP($jobs['wid'],$resource['cp']);
|
||||
$deletIDs[] = (int) $jobs['id'];
|
||||
if($jobs['type'] == 18) {
|
||||
$owner = $database->getVillageField($jobs['wid'],"owner");
|
||||
$max = $bid18[$level]['attri'];
|
||||
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $owner";
|
||||
$database->query($q);
|
||||
} else {
|
||||
// if we only have 2 gold, we need to cancel this job, as there will never
|
||||
// be enough gold now in our account to finish this up
|
||||
$exclude_master = true;
|
||||
$deletIDs[] = (int) $jobs['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) {
|
||||
$innertimestamp = $jobs['timestamp'];
|
||||
} else {
|
||||
// non-master builder build, we should count +2 gold for it
|
||||
$countPlus2Gold = true;
|
||||
$jobFinishSuccess = true;
|
||||
}
|
||||
|
||||
// update build level in the database
|
||||
if ($jobFinishSuccess) {
|
||||
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
|
||||
}
|
||||
|
||||
if (!isset($exclude_master) && $database->query($q) && ($enought_res == 1 || $jobs['master'] == 0)) {
|
||||
$database->modifyPop($jobs['wid'],$resource['pop'],0);
|
||||
$database->addCP($jobs['wid'],$resource['cp']);
|
||||
$deletIDs[] = (int) $jobs['id'];
|
||||
if($jobs['type'] == 18) {
|
||||
$owner = $database->getVillageField($jobs['wid'],"owner");
|
||||
$max = $bid18[$level]['attri'];
|
||||
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $owner";
|
||||
$database->query($q);
|
||||
}
|
||||
}
|
||||
|
||||
if (($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) {
|
||||
$innertimestamp = $jobs['timestamp'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset the flag for the next job
|
||||
$jobFinishSuccess = false;
|
||||
}
|
||||
|
||||
if (count($deletIDs)) {
|
||||
$database->query("DELETE FROM " . TB_PREFIX . "bdata WHERE id IN(" . implode(', ', $deletIDs) . ")");
|
||||
}
|
||||
|
||||
$demolition = $database->finishDemolition($village->wid);
|
||||
$tech = $technology->finishTech();
|
||||
if ($demolition > 0 || $tech > 0) {
|
||||
$countPlus2Gold = true;
|
||||
$logging->goldFinLog($village->wid);
|
||||
}
|
||||
|
||||
// deduct the right amount of gold
|
||||
if ($countMasterGold || $countPlus2Gold) {
|
||||
$newgold = $session->gold - (($countMasterGold && $countPlus2Gold) ? 3 : 2);
|
||||
$database->updateUserField($session->uid, "gold", $newgold, 1);
|
||||
}
|
||||
|
||||
$stillbuildingarray = $database->getJobs($village->wid);
|
||||
if (count($stillbuildingarray) == 1) {
|
||||
if($stillbuildingarray[0]['loopcon'] == 1) {
|
||||
//$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0,timestamp=".(time()+$stillbuildingarray[0]['timestamp']-$innertimestamp)." WHERE id=".$stillbuildingarray[0]['id'];
|
||||
$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0 WHERE id=".(int) $stillbuildingarray[0]['id'];
|
||||
$database->query($q);
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: ".($redirect_url ? $redirect_url : $session->referrer));
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
|
||||
// reset the flag for the next job
|
||||
$jobFinishSuccess = false;
|
||||
}
|
||||
|
||||
if (count($deletIDs)) {
|
||||
$database->query("DELETE FROM " . TB_PREFIX . "bdata WHERE id IN(" . implode(', ', $deletIDs) . ")");
|
||||
}
|
||||
|
||||
$demolition = $database->finishDemolition($village->wid);
|
||||
$tech = $technology->finishTech();
|
||||
if ($demolition > 0 || $tech > 0) {
|
||||
$countPlus2Gold = true;
|
||||
$logging->goldFinLog($village->wid);
|
||||
}
|
||||
|
||||
// deduct the right amount of gold
|
||||
if ($countMasterGold || $countPlus2Gold) {
|
||||
$newgold = $session->gold - (($countMasterGold && $countPlus2Gold) ? 3 : 2);
|
||||
$database->updateUserField($session->uid, "gold", $newgold, 1);
|
||||
}
|
||||
|
||||
$stillbuildingarray = $database->getJobs($village->wid);
|
||||
if (count($stillbuildingarray) == 1) {
|
||||
if($stillbuildingarray[0]['loopcon'] == 1) {
|
||||
//$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0,timestamp=".(time()+$stillbuildingarray[0]['timestamp']-$innertimestamp)." WHERE id=".$stillbuildingarray[0]['id'];
|
||||
$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0 WHERE id=".(int) $stillbuildingarray[0]['id'];
|
||||
$database->query($q);
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: ".($redirect_url ? $redirect_url : $session->referrer));
|
||||
exit;
|
||||
}
|
||||
|
||||
public function resourceRequired($id, $tid, $plus = 1) {
|
||||
|
||||
+11
-32
@@ -94,6 +94,7 @@ class Market
|
||||
$ctrans = str_replace("-", "", $ctrans);
|
||||
$itrans = str_replace("-", "", $itrans);
|
||||
$crtrans = str_replace("-", "", $crtrans);
|
||||
|
||||
// preload all village data, since we're retrieving some of those separately below
|
||||
$database->getVillage($village->wid);
|
||||
|
||||
@@ -101,15 +102,11 @@ class Market
|
||||
$availableClay = $database->getClayAvailable($village->wid);
|
||||
$availableIron = $database->getIronAvailable($village->wid);
|
||||
$availableCrop = $database->getCropAvailable($village->wid);
|
||||
//check if vacation mode:
|
||||
|
||||
//check if on vacation:
|
||||
if($database->getvacmodexy($id)) $form->addError("error", USER_ON_VACATION);
|
||||
|
||||
if($session->access == BANNED)
|
||||
{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
elseif(!$database->checkVilExist($post['getwref'])) $form->addError("error", NO_COORDINATES_SELECTED);
|
||||
if(!$database->checkVilExist($post['getwref'])) $form->addError("error", NO_COORDINATES_SELECTED);
|
||||
elseif($post['getwref'] == $village->wid) $form->addError("error", CANNOT_SEND_RESOURCES);
|
||||
elseif($post['send3'] < 1 || $post['send3'] > 3 || ($post['send3'] > 1 && !$session->goldclub)) $form->addError("error", INVALID_MERCHANTS_REPETITION);
|
||||
elseif($availableWood >= $post['r1'] && $availableClay >= $post['r2'] && $availableIron >= $post['r3'] && $availableCrop >= $post['r4'])
|
||||
@@ -190,13 +187,7 @@ class Market
|
||||
$availableIron = $database->getIronAvailable($village->wid);
|
||||
$availableCrop = $database->getCropAvailable($village->wid);
|
||||
|
||||
if($session->access == BANNED)
|
||||
{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
elseif($availableWood >= $wood && $availableClay >= $clay && $availableIron >= $iron && $availableCrop >= $crop)
|
||||
if($availableWood >= $wood && $availableClay >= $clay && $availableIron >= $iron && $availableCrop >= $crop)
|
||||
{
|
||||
$reqMerc = 1;
|
||||
|
||||
@@ -355,18 +346,10 @@ class Market
|
||||
global $session,$database,$village;
|
||||
|
||||
$wwvillage = $database->getResourceLevel($village->wid);
|
||||
if($wwvillage['f99t'] != 40)
|
||||
{
|
||||
if($session->userinfo['gold'] >= 3)
|
||||
{
|
||||
//check if there are too many resources
|
||||
if($session->access == BANNED)
|
||||
{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
else if (($post['m2'][0]+$post['m2'][1]+$post['m2'][2]+$post['m2'][3])<=(round($village->awood)+round($village->aclay)+round($village->airon)+round($village->acrop)))
|
||||
{
|
||||
if($wwvillage['f99t'] != 40){
|
||||
if($session->userinfo['gold'] >= 3){
|
||||
//Check if there are too many resources
|
||||
if(($post['m2'][0]+$post['m2'][1]+$post['m2'][2]+$post['m2'][3])<=(round($village->awood)+round($village->aclay)+round($village->airon)+round($village->acrop))){
|
||||
$database->setVillageField(
|
||||
$village->wid,
|
||||
["wood", "clay", "iron", "crop"],
|
||||
@@ -375,15 +358,11 @@ class Market
|
||||
$database->modifyGold($session->uid, 3, 0);
|
||||
header("Location: build.php?id=".$post['id']."&t=3&c");;
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
header("Location: build.php?id=".$post['id']."&t=3");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}else{
|
||||
header("Location: build.php?id=".$post['id']."&t=3");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -11,15 +11,9 @@
|
||||
|
||||
|
||||
class Profile {
|
||||
|
||||
public function procProfile($post) {
|
||||
global $session;
|
||||
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($post['ft'])) {
|
||||
switch($post['ft']) {
|
||||
case "p1" :
|
||||
@@ -40,11 +34,6 @@ class Profile {
|
||||
public function procSpecial($get) {
|
||||
global $session;
|
||||
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($get['e'])) {
|
||||
switch($get['e']) {
|
||||
case 2 :
|
||||
|
||||
+17
-1
@@ -172,7 +172,7 @@ class Session {
|
||||
$admin = true;
|
||||
}
|
||||
|
||||
if($user && ($admin || isset($_SESSION['sessid']))) {
|
||||
if($user && ($admin || isset($_SESSION['sessid']))) {
|
||||
$this->maintenance();
|
||||
$this->isWinner();
|
||||
|
||||
@@ -187,6 +187,10 @@ class Session {
|
||||
|
||||
//Get and Populate Data
|
||||
$this->PopulateVar();
|
||||
|
||||
//Check if the player is banned
|
||||
$this->isBanned();
|
||||
|
||||
//update database
|
||||
$database->updateActiveUser($user, $this->time);
|
||||
return true;
|
||||
@@ -194,6 +198,18 @@ class Session {
|
||||
else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called if the player is banned
|
||||
*
|
||||
*/
|
||||
|
||||
function isBanned(){
|
||||
if($this->access == BANNED && !in_array(basename($_SERVER['PHP_SELF']), ['banned.php', 'nachrichten.php', 'rules.php'])){
|
||||
header('Location: banned.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server is under maintenance
|
||||
*
|
||||
|
||||
+36
-40
@@ -370,46 +370,42 @@ class Technology {
|
||||
|
||||
private function procTrain($post, $great = false) {
|
||||
global $session;
|
||||
if($session->access != BANNED){
|
||||
// first of all, check if we're not trying to train chieftain
|
||||
// and settlers together - which we cannot, since that can result
|
||||
// in 1 chieftain and 3 settlers, then conquering a village, then
|
||||
// founding a new one, all with only 1 available slot
|
||||
if (
|
||||
!(
|
||||
(!empty($post['t9']) && !empty($post['t10'])) ||
|
||||
(!empty($post['t19']) && !empty($post['t20'])) ||
|
||||
(!empty($post['t29']) && !empty($post['t30'])) ||
|
||||
(!empty($post['t39']) && !empty($post['t40'])) ||
|
||||
(!empty($post['t49']) && !empty($post['t50']))
|
||||
)
|
||||
) {
|
||||
$start = ($session->tribe - 1) * 10 + 1;
|
||||
$end = ($session->tribe * 10);
|
||||
for ($i = $start; $i <= $end; $i ++ ) {
|
||||
if (isset($post['t'.$i]) && $post['t'.$i] != 0) {
|
||||
$amt = intval($post['t'.$i]);
|
||||
if ($amt < 0) $amt = 1;
|
||||
$this->trainUnit($i, $amt, $great);
|
||||
}
|
||||
}
|
||||
|
||||
if($session->tribe == 3)
|
||||
{
|
||||
if (isset($post['t99']) && $post['t99'] != 0) {
|
||||
$amt = intval($post['t99']);
|
||||
if ($amt < 0) $amt = 1;
|
||||
$this->trainUnit(99, $amt, $great);
|
||||
}
|
||||
}
|
||||
|
||||
header( "Location: build.php?id=" . $post['id'] );
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// first of all, check if we're not trying to train chieftain
|
||||
// and settlers together - which we cannot, since that can result
|
||||
// in 1 chieftain and 3 settlers, then conquering a village, then
|
||||
// founding a new one, all with only 1 available slot
|
||||
if (
|
||||
!(
|
||||
(!empty($post['t9']) && !empty($post['t10'])) ||
|
||||
(!empty($post['t19']) && !empty($post['t20'])) ||
|
||||
(!empty($post['t29']) && !empty($post['t30'])) ||
|
||||
(!empty($post['t39']) && !empty($post['t40'])) ||
|
||||
(!empty($post['t49']) && !empty($post['t50']))
|
||||
)
|
||||
) {
|
||||
$start = ($session->tribe - 1) * 10 + 1;
|
||||
$end = ($session->tribe * 10);
|
||||
for ($i = $start; $i <= $end; $i ++ ) {
|
||||
if (isset($post['t'.$i]) && $post['t'.$i] != 0) {
|
||||
$amt = intval($post['t'.$i]);
|
||||
if ($amt < 0) $amt = 1;
|
||||
$this->trainUnit($i, $amt, $great);
|
||||
}
|
||||
}
|
||||
|
||||
if($session->tribe == 3)
|
||||
{
|
||||
if (isset($post['t99']) && $post['t99'] != 0) {
|
||||
$amt = intval($post['t99']);
|
||||
if ($amt < 0) $amt = 1;
|
||||
$this->trainUnit(99, $amt, $great);
|
||||
}
|
||||
}
|
||||
|
||||
header( "Location: build.php?id=" . $post['id'] );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function getUpkeep($array, $type, $vid = 0, $prisoners = 0) {
|
||||
|
||||
+221
-235
@@ -253,278 +253,264 @@ 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['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 ($form->returnErrors() > 0) {
|
||||
if($form->returnErrors() > 0){
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header( "Location: a2b.php" );
|
||||
exit;
|
||||
} else {
|
||||
if ($session->access != BANNED) {
|
||||
$u = ($session->tribe == 1) ? "" : $session->tribe - 1;
|
||||
|
||||
$database->modifyUnit(
|
||||
$village->wid,
|
||||
[
|
||||
$u . "1",
|
||||
$u . "2",
|
||||
$u . "3",
|
||||
$u . "4",
|
||||
$u . "5",
|
||||
$u . "6",
|
||||
$u . "7",
|
||||
$u . "8",
|
||||
$u . "9",
|
||||
$u . $session->tribe . "0",
|
||||
"hero"
|
||||
],
|
||||
[
|
||||
$data['u1'],
|
||||
$data['u2'],
|
||||
$data['u3'],
|
||||
$data['u4'],
|
||||
$data['u5'],
|
||||
$data['u6'],
|
||||
$data['u7'],
|
||||
$data['u8'],
|
||||
$data['u9'],
|
||||
$data['u10'],
|
||||
$data['u11']
|
||||
],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
}else{
|
||||
$u = ($session->tribe == 1) ? "" : $session->tribe - 1;
|
||||
|
||||
$database->modifyUnit(
|
||||
$village->wid,
|
||||
[
|
||||
$u . "1",
|
||||
$u . "2",
|
||||
$u . "3",
|
||||
$u . "4",
|
||||
$u . "5",
|
||||
$u . "6",
|
||||
$u . "7",
|
||||
$u . "8",
|
||||
$u . "9",
|
||||
$u . $session->tribe . "0",
|
||||
"hero"
|
||||
],
|
||||
[
|
||||
$data['u1'],
|
||||
$data['u2'],
|
||||
$data['u3'],
|
||||
$data['u4'],
|
||||
$data['u5'],
|
||||
$data['u6'],
|
||||
$data['u7'],
|
||||
$data['u8'],
|
||||
$data['u9'],
|
||||
$data['u10'],
|
||||
$data['u11']
|
||||
],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
);
|
||||
|
||||
$troopsTime = $this->getWalkingTroopsTime($village->wid, $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
// Check if have WW owner have artefact Rivals great confusion or Artefact of the unique fool with that effect
|
||||
// If is a WW village you can target on WW , if is not a WW village catapults will target randomly.
|
||||
// Like it says : Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact.
|
||||
// Fixed by Advocaite and Shadow - Optimized by iopietro
|
||||
|
||||
$to_owner = $database->getVillageField($data['to_vid'], "owner");
|
||||
$rivalsGreatConfusion = $database->getArtifactsSumByKind($to_owner, $data['to_vid'], 7);
|
||||
|
||||
$rallyPointLevel = ($village->resarray)['f39'];
|
||||
$invalidBuildings = [];
|
||||
|
||||
// fill the array with the invalid buildings
|
||||
if($rallyPointLevel >= 3 && $rallyPointLevel < 5){
|
||||
for($i = 1; $i <= 37; $i++){
|
||||
if(!in_array($i, [10, 11])) $invalidBuildings[] = $i;
|
||||
}
|
||||
|
||||
$troopsTime = $this->getWalkingTroopsTime($village->wid, $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
// Check if have WW owner have artefact Rivals great confusion or Artefact of the unique fool with that effect
|
||||
// If is a WW village you can target on WW , if is not a WW village catapults will target randomly.
|
||||
// Like it says : Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact.
|
||||
// Fixed by Advocaite and Shadow - Optimized by iopietro
|
||||
|
||||
$to_owner = $database->getVillageField($data['to_vid'], "owner");
|
||||
$rivalsGreatConfusion = $database->getArtifactsSumByKind($to_owner, $data['to_vid'], 7);
|
||||
|
||||
$rallyPointLevel = ($village->resarray)['f39'];
|
||||
$invalidBuildings = [];
|
||||
|
||||
// fill the array with the invalid buildings
|
||||
if($rallyPointLevel >= 3 && $rallyPointLevel < 5){
|
||||
for($i = 1; $i <= 37; $i++){
|
||||
if(!in_array($i, [10, 11])) $invalidBuildings[] = $i;
|
||||
}
|
||||
else if($rallyPointLevel >= 5 && $rallyPointLevel < 10){
|
||||
for($i = 12; $i <= 37; $i++) $invalidBuildings[] = $i;
|
||||
}
|
||||
else if($rallyPointLevel >= 5 && $rallyPointLevel < 10){
|
||||
for($i = 12; $i <= 37; $i++) $invalidBuildings[] = $i;
|
||||
}
|
||||
else if($rallyPointLevel >= 10){
|
||||
$invalidBuildings = [23, 31, 32, 33, 34, 36];
|
||||
}
|
||||
|
||||
if(isset($post['ctar1']) && $post['ctar1'] != 0){
|
||||
// check if the player has selected a valid building
|
||||
if($rallyPointLevel < 3 || $data['u8'] == 0 || in_array($post['ctar1'], $invalidBuildings) || $post['ctar1'] < 0 || $post['ctar1'] > 40){
|
||||
$post['ctar1'] = 0;
|
||||
}
|
||||
else if($rallyPointLevel >= 10){
|
||||
$invalidBuildings = [23, 31, 32, 33, 34, 36];
|
||||
}
|
||||
|
||||
if(isset($post['ctar1']) && $post['ctar1'] != 0){
|
||||
}
|
||||
|
||||
if(isset($post['ctar2']) && $post['ctar2'] != 0){
|
||||
// check if there are atleast 20 catapults
|
||||
if($data['u8'] < 20 || $rallyPointLevel != 20){
|
||||
$post['ctar2'] = 0;
|
||||
}else{
|
||||
// check if the player has selected a valid building
|
||||
if($rallyPointLevel < 3 || $data['u8'] == 0 || in_array($post['ctar1'], $invalidBuildings) || $post['ctar1'] < 0 || $post['ctar1'] > 40){
|
||||
$post['ctar1'] = 0;
|
||||
if(in_array($post['ctar2'], $invalidBuildings) || ($post['ctar2'] < 0 || $post['ctar2'] > 40 && $post['ctar2'] != 99)){
|
||||
$post['ctar2'] = 99;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($post['ctar2']) && $post['ctar2'] != 0){
|
||||
// check if there are atleast 20 catapults
|
||||
if($data['u8'] < 20 || $rallyPointLevel != 20){
|
||||
$post['ctar2'] = 0;
|
||||
}else{
|
||||
// check if the player has selected a valid building
|
||||
if(in_array($post['ctar2'], $invalidBuildings) || ($post['ctar2'] < 0 || $post['ctar2'] > 40 && $post['ctar2'] != 99)){
|
||||
}
|
||||
|
||||
if(isset($post['ctar1'])) {
|
||||
//Is the Brewery built?
|
||||
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
|
||||
if($rivalsGreatConfusion['totals'] > 0) {
|
||||
if($post['ctar1'] != 40 && ($post['ctar1'] != 27 || ($post['ctar1'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
|
||||
$post['ctar1'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else $post['ctar1'] = 0;
|
||||
}
|
||||
else $post['ctar1'] = 0;
|
||||
|
||||
if(isset($post['ctar2']) && $post['ctar2'] > 0) {
|
||||
//Is the Brewery built?
|
||||
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
|
||||
if($rivalsGreatConfusion['totals'] > 0) {
|
||||
if ($post['ctar2'] != 40 && ($post['ctar2'] != 27 || ($post['ctar2'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
|
||||
$post['ctar2'] = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($post['ctar1'])) {
|
||||
//Is the Brewery built?
|
||||
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
|
||||
if($rivalsGreatConfusion['totals'] > 0) {
|
||||
if($post['ctar1'] != 40 && ($post['ctar1'] != 27 || ($post['ctar1'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
|
||||
$post['ctar1'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else $post['ctar1'] = 0;
|
||||
}
|
||||
else $post['ctar1'] = 0;
|
||||
|
||||
if(isset($post['ctar2']) && $post['ctar2'] > 0) {
|
||||
//Is the Brewery built?
|
||||
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
|
||||
if($rivalsGreatConfusion['totals'] > 0) {
|
||||
if ($post['ctar2'] != 40 && ($post['ctar2'] != 27 || ($post['ctar2'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
|
||||
$post['ctar2'] = 99;
|
||||
}
|
||||
}
|
||||
}
|
||||
else $post['ctar2'] = 99;
|
||||
else $post['ctar2'] = 99;
|
||||
}
|
||||
else $post['ctar2'] = 0;
|
||||
|
||||
if(!isset($post['spy'])) $post['spy'] = 0;
|
||||
|
||||
$abdata = $database->getABTech($village->wid);
|
||||
$reference = $database->addAttack(($village->wid), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $post['ctar1'], $post['ctar2'], $post['spy'], $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
|
||||
$checkexist = $database->checkVilExist($data['to_vid']);
|
||||
$checkoexist = $database->checkOasisExist($data['to_vid']);
|
||||
if($checkexist || $checkoexist) {
|
||||
$database->addMovement(3, $village->wid, $data['to_vid'], $reference, time(), ($time + time()));
|
||||
if ($database->hasBeginnerProtection($village->wid) == 1 && $checkexist) {
|
||||
mysqli_query($database->dblink, "UPDATE " . TB_PREFIX . "users SET protect = 0 WHERE id = ".(int) $session->uid);
|
||||
}
|
||||
else $post['ctar2'] = 0;
|
||||
|
||||
if(!isset($post['spy'])) $post['spy'] = 0;
|
||||
|
||||
$abdata = $database->getABTech($village->wid);
|
||||
$reference = $database->addAttack(($village->wid), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $post['ctar1'], $post['ctar2'], $post['spy'], $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
|
||||
$checkexist = $database->checkVilExist($data['to_vid']);
|
||||
$checkoexist = $database->checkOasisExist($data['to_vid']);
|
||||
if($checkexist || $checkoexist) {
|
||||
$database->addMovement(3, $village->wid, $data['to_vid'], $reference, time(), ($time + time()));
|
||||
if ($database->hasBeginnerProtection($village->wid) == 1 && $checkexist) {
|
||||
mysqli_query($database->dblink, "UPDATE " . TB_PREFIX . "users SET protect = 0 WHERE id = ".(int) $session->uid);
|
||||
}
|
||||
}
|
||||
|
||||
if($form->returnErrors() > 0) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header("Location: a2b.php" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// prevent re-use of the same attack via re-POSTing the same data
|
||||
$database->remA2b($data['id']);
|
||||
|
||||
header("Location: build.php?id=39");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
}
|
||||
|
||||
if($form->returnErrors() > 0) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header("Location: a2b.php" );
|
||||
exit;
|
||||
}
|
||||
|
||||
// prevent re-use of the same attack via re-POSTing the same data
|
||||
$database->remA2b($data['id']);
|
||||
|
||||
header("Location: build.php?id=39");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function sendTroopsBack($post) {
|
||||
global $form, $database, $village, $session, $technology;
|
||||
if ( $session->access != BANNED ) {
|
||||
$enforce = $database->getEnforceArray( $post['ckey'], 0 );
|
||||
$enforceoasis = $database->getOasisEnforceArray( $post['ckey'], 0 );
|
||||
if ( ( $enforce['from'] == $village->wid ) || ( $enforce['vref'] == $village->wid ) || ( $enforceoasis['conqured'] == $village->wid ) ) {
|
||||
$to = $database->getVillage( $enforce['from'] );
|
||||
$Gtribe = ($ownerTribe = $database->getUserField( $to['owner'], 'tribe', 0)) == 1 ? "" : $ownerTribe - 1;
|
||||
|
||||
for ( $i = 1; $i < 10; $i ++ ) {
|
||||
if ( isset( $post[ 't' . $i ] ) ) {
|
||||
if ( $i != 10 ) {
|
||||
if ( $post[ 't' . $i ] > $enforce[ 'u' . $Gtribe . $i ] ) {
|
||||
$form->addError( "error", "You can't send back more units than you have" );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $post[ 't' . $i ] < 0 ) {
|
||||
$form->addError( "error", "You can't send back negative units." );
|
||||
break;
|
||||
}
|
||||
$enforce = $database->getEnforceArray( $post['ckey'], 0 );
|
||||
$enforceoasis = $database->getOasisEnforceArray( $post['ckey'], 0 );
|
||||
if ( ( $enforce['from'] == $village->wid ) || ( $enforce['vref'] == $village->wid ) || ( $enforceoasis['conqured'] == $village->wid ) ) {
|
||||
$to = $database->getVillage( $enforce['from'] );
|
||||
$Gtribe = ($ownerTribe = $database->getUserField( $to['owner'], 'tribe', 0)) == 1 ? "" : $ownerTribe - 1;
|
||||
|
||||
for ( $i = 1; $i < 10; $i ++ ) {
|
||||
if ( isset( $post[ 't' . $i ] ) ) {
|
||||
if ( $i != 10 ) {
|
||||
if ( $post[ 't' . $i ] > $enforce[ 'u' . $Gtribe . $i ] ) {
|
||||
$form->addError( "error", "You can't send back more units than you have" );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $post[ 't' . $i ] < 0 ) {
|
||||
$form->addError( "error", "You can't send back negative units." );
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$post[ 't' . $i . '' ] = '0';
|
||||
}
|
||||
}
|
||||
if ( isset( $post['t11'] ) ) {
|
||||
if ( $post['t11'] > $enforce['hero'] ) {
|
||||
$form->addError( "error", "You can't send back more units than you have" );
|
||||
}
|
||||
|
||||
if ( $post['t11'] < 0 ) {
|
||||
$form->addError( "error", "You can't send back negative units." );
|
||||
}
|
||||
} else {
|
||||
$post['t11'] = '0';
|
||||
$post[ 't' . $i . '' ] = '0';
|
||||
}
|
||||
|
||||
if ( $form->returnErrors() > 0 ) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header( "Location: a2b.php" );
|
||||
exit;
|
||||
} else {
|
||||
|
||||
//change units
|
||||
$tribe = $database->getUserField($to['owner'], 'tribe', 0);
|
||||
$start = ($tribe - 1 ) * 10 + 1;
|
||||
$end = $tribe * 10 ;
|
||||
|
||||
$units = [];
|
||||
$amounts = [];
|
||||
$modes = [];
|
||||
|
||||
$j = 1;
|
||||
for ( $i = $start; $i <= $end; $i ++ ) {
|
||||
$units[] = $i;
|
||||
$amounts[] = $post[ 't' . $j . '' ];
|
||||
$modes[] = 0;
|
||||
$j ++;
|
||||
}
|
||||
|
||||
$units[] = 'hero';
|
||||
$amounts[] = $post['t11'];
|
||||
}
|
||||
if ( isset( $post['t11'] ) ) {
|
||||
if ( $post['t11'] > $enforce['hero'] ) {
|
||||
$form->addError( "error", "You can't send back more units than you have" );
|
||||
}
|
||||
|
||||
if ( $post['t11'] < 0 ) {
|
||||
$form->addError( "error", "You can't send back negative units." );
|
||||
}
|
||||
} else {
|
||||
$post['t11'] = '0';
|
||||
}
|
||||
|
||||
if ( $form->returnErrors() > 0 ) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header( "Location: a2b.php" );
|
||||
exit;
|
||||
} else {
|
||||
|
||||
//change units
|
||||
$tribe = $database->getUserField($to['owner'], 'tribe', 0);
|
||||
$start = ($tribe - 1 ) * 10 + 1;
|
||||
$end = $tribe * 10 ;
|
||||
|
||||
$units = [];
|
||||
$amounts = [];
|
||||
$modes = [];
|
||||
|
||||
$j = 1;
|
||||
for ( $i = $start; $i <= $end; $i ++ ) {
|
||||
$units[] = $i;
|
||||
$amounts[] = $post[ 't' . $j . '' ];
|
||||
$modes[] = 0;
|
||||
|
||||
$database->modifyEnforce($post['ckey'], $units, $amounts, $modes);
|
||||
$j++;
|
||||
|
||||
$troopsTime = $this->getWalkingTroopsTime($enforce['from'], $enforce['vref'], $to['owner'], $tribe, $post, 1, 't');
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
$reference = $database->addAttack($enforce['from'], $post['t1'], $post['t2'], $post['t3'], $post['t4'], $post['t5'], $post['t6'], $post['t7'], $post['t8'], $post['t9'], $post['t10'], $post['t11'], 2, 0, 0, 0, 0);
|
||||
$database->addMovement(4, $village->wid, $enforce['from'], $reference, time(), ($time + time()));
|
||||
$technology->checkReinf($post['ckey'], false);
|
||||
|
||||
header("Location: build.php?id=39&refresh=1");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
$form->addError("error", "You cant change someones troops.");
|
||||
if($form->returnErrors() > 0){
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header("Location: a2b.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit();
|
||||
}
|
||||
$j ++;
|
||||
}
|
||||
|
||||
$units[] = 'hero';
|
||||
$amounts[] = $post['t11'];
|
||||
$modes[] = 0;
|
||||
|
||||
$database->modifyEnforce($post['ckey'], $units, $amounts, $modes);
|
||||
$j++;
|
||||
|
||||
$troopsTime = $this->getWalkingTroopsTime($enforce['from'], $enforce['vref'], $to['owner'], $tribe, $post, 1, 't');
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
$reference = $database->addAttack($enforce['from'], $post['t1'], $post['t2'], $post['t3'], $post['t4'], $post['t5'], $post['t6'], $post['t7'], $post['t8'], $post['t9'], $post['t10'], $post['t11'], 2, 0, 0, 0, 0);
|
||||
$database->addMovement(4, $village->wid, $enforce['from'], $reference, time(), ($time + time()));
|
||||
$technology->checkReinf($post['ckey'], false);
|
||||
|
||||
header("Location: build.php?id=39&refresh=1");
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
$form->addError("error", "You cant change someones troops.");
|
||||
if($form->returnErrors() > 0){
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $_POST;
|
||||
header("Location: a2b.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function Settlers($post) {
|
||||
global $form, $database, $village, $session;
|
||||
|
||||
if ($session->access != BANNED) {
|
||||
$mode = CP;
|
||||
$total = count($database->getProfileVillages($session->uid));
|
||||
$need_cps = ${'cp'.$mode}[$total + 1];
|
||||
$cps = $session->cp;
|
||||
$rallypoint = $database->getResourceLevel($village->wid);
|
||||
|
||||
//-- Prevent user from founding a new village if there are not enough settlers or the player put an invalid village ID or an already occupied one
|
||||
//-- fix by AL-Kateb - Semplified and additions by iopietro
|
||||
if ($rallypoint['f39'] > 0 && $village->unitarray['u'.$session->tribe.'0'] >= 3 && isset($post['s']) && ($newvillage = $database->getMInfo($post['s']))['id'] > 0 && $newvillage['occupied'] == 0 && $newvillage['oasistype'] == 0) {
|
||||
if ($cps >= $need_cps) {
|
||||
$troopsTime = $this->getWalkingTroopsTime($village->wid, $newvillage['id'], 0, 0, [300], 0);
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
$unit = ($session->tribe * 10);
|
||||
$database->modifyResource($village->wid, 750, 750, 750, 750, 0);
|
||||
$database->modifyUnit($village->wid, [$unit], [3], [0]);
|
||||
$database->addMovement(5, $village->wid, $post['s'], 0, time(), time() + $time);
|
||||
}
|
||||
header("Location: build.php?id=39");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: dorf1.php");
|
||||
exit;
|
||||
$mode = CP;
|
||||
$total = count($database->getProfileVillages($session->uid));
|
||||
$need_cps = ${'cp'.$mode}[$total + 1];
|
||||
$cps = $session->cp;
|
||||
$rallypoint = $database->getResourceLevel($village->wid);
|
||||
|
||||
//-- Prevent user from founding a new village if there are not enough settlers or the player put an invalid village ID or an already occupied one
|
||||
//-- fix by AL-Kateb - Semplified and additions by iopietro
|
||||
if ($rallypoint['f39'] > 0 && $village->unitarray['u'.$session->tribe.'0'] >= 3 && isset($post['s']) && ($newvillage = $database->getMInfo($post['s']))['id'] > 0 && $newvillage['occupied'] == 0 && $newvillage['oasistype'] == 0) {
|
||||
if ($cps >= $need_cps) {
|
||||
$troopsTime = $this->getWalkingTroopsTime($village->wid, $newvillage['id'], 0, 0, [300], 0);
|
||||
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
|
||||
|
||||
$unit = ($session->tribe * 10);
|
||||
$database->modifyResource($village->wid, 750, 750, 750, 750, 0);
|
||||
$database->modifyUnit($village->wid, [$unit], [3], [0]);
|
||||
$database->addMovement(5, $village->wid, $post['s'], 0, time(), time() + $time);
|
||||
}
|
||||
header("Location: build.php?id=39");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
header("Location: dorf1.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($session->access != ADMIN && ($session->alliance == 0 || ($session->alliance > 0 && !$opt['opt5']))) $alliance->redirect($_GET);
|
||||
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
// # FIX BY RONIX ##
|
||||
// # TRAVIANZ ##
|
||||
// ###########################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$topic_id = $_GET['tid'];
|
||||
$post_id = $_GET['pod'];
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
// # FIX BY RONIX ##
|
||||
// # TRAVIANZ ##
|
||||
// ###########################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$opt = $database->getAlliPermissions($session->uid, $aid);
|
||||
$displayarray = $database->getUserArray($session->uid, 1);
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$topicID = $_GET['idt'];
|
||||
$showTopic = reset($database->ShowTopic($topicID));
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$cat_id = $_GET['fid'];
|
||||
$forumInfo = $database->ForumCatEdit($cat_id);
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$cat_id = $_GET['fid'];
|
||||
$forumData = reset($database->ForumCatEdit($cat_id));
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
// # FIX BY RONIX ##
|
||||
// # TRAVIANZ ##
|
||||
// ###########################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$tid = $_GET['tid'];
|
||||
$topics = $database->ShowTopic($tid);
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<?php
|
||||
//////////////// made by TTMTT ////////////////
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$tid = $_GET['tid'];
|
||||
$topic = reset($database->ShowTopic($tid));
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$forumData = reset($database->ForumCatEdit($_GET['idf']));
|
||||
if(empty($forumData) || ($forumData['alliance'] == 0 && $session->access != ADMIN) ||
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
## FIX BY RONIX ##
|
||||
## TRAVIANZ ##
|
||||
############################################################
|
||||
if($session->access == BANNED){
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$topic_id = $_GET['idt'];
|
||||
$topics = $database->ShowTopic($topic_id);
|
||||
|
||||
@@ -5,8 +5,7 @@ $allianceinfo = $database->getAlliance($aid);
|
||||
$memberlist = $database->getAllMember($aid);
|
||||
|
||||
echo "<h1>".$allianceinfo['tag']." - ".$allianceinfo['name']."</h1>";
|
||||
include("alli_menu.tpl");
|
||||
if($session->access!=BANNED){
|
||||
include("alli_menu.tpl");
|
||||
?>
|
||||
<form method="post" action="allianz.php">
|
||||
<table cellpadding="1" cellspacing="1" id="position" class="small_option">
|
||||
@@ -41,9 +40,3 @@ if($session->access!=BANNED){
|
||||
<button value="ok" name="s1" id="btn_ok" class="trav_buttons">OK</button>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
+10
-28
@@ -1,39 +1,25 @@
|
||||
<?php
|
||||
$ty=(isset($_GET['ty']))? $_GET['ty']:"";
|
||||
$ty = (isset($_GET['ty']))? $_GET['ty']:"";
|
||||
if(isset($_REQUEST["cancel"]) && $_REQUEST["cancel"] == "1") {
|
||||
if($session->access != BANNED){
|
||||
$database->delDemolition($village->wid);
|
||||
header("Location: build.php?gid=15&ty=$ty&cancel=0&demolish=0");
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($session->alliance) {
|
||||
$memberCount = $database->countAllianceMembers($session->alliance);
|
||||
} else {
|
||||
$memberCount = 0;
|
||||
}
|
||||
if($session->alliance) $memberCount = $database->countAllianceMembers($session->alliance);
|
||||
else $memberCount = 0;
|
||||
|
||||
if(!empty($_REQUEST["demolish"]) && $_REQUEST["c"] == $session->mchecker) {
|
||||
if($session->access != BANNED){
|
||||
if($_REQUEST["type"] != null && ($_REQUEST["type"] >= 19 && $_REQUEST["type"] <= 40 || $_REQUEST["type"] == 99)) {
|
||||
$type = $_REQUEST['type'];
|
||||
$demolish_permitted = $database->addDemolition($village->wid,$type);
|
||||
if ($demolish_permitted === true) {
|
||||
$session->changeChecker();
|
||||
header("Location: build.php?gid=15&ty=$type&cancel=0&demolish=0");
|
||||
} else {
|
||||
header("Location: build.php?gid=15&ty=$type&nodemolish=".$demolish_permitted);
|
||||
}
|
||||
exit;
|
||||
$session->changeChecker();
|
||||
header("Location: build.php?gid=15&ty=$type&cancel=0&demolish=0");
|
||||
}
|
||||
else header("Location: build.php?gid=15&ty=$type&nodemolish=".$demolish_permitted);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if($village->resarray['f'.$id] >= DEMOLISH_LEVEL_REQ) {
|
||||
@@ -46,13 +32,9 @@ if($village->resarray['f'.$id] >= DEMOLISH_LEVEL_REQ) {
|
||||
echo "<a href='build.php?id=".$_GET['id']."&ty=".$ty."&cancel=1'><img src='img/x.gif' class='del' title='".CANCEL."' alt='cancel'></a> ";
|
||||
echo "".DEMOLITION_OF." ".$building->procResType($VillageResourceLevels['f'.$Demolition['buildnumber'].'t']).": <span id=timer1>".$generator->getTimeFormat($Demolition['timetofinish']-time())."</span>";
|
||||
if($session->gold >= 2) {
|
||||
if($session->access!=BANNED){
|
||||
?> <a href="?id=15&buildingFinish=1&ty=<?php echo $ty;?>" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="<?php echo FINISH_GOLD; ?>"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
|
||||
?>
|
||||
<a href="?id=15&buildingFinish=1&ty=<?php echo $ty;?>" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="<?php echo FINISH_GOLD; ?>"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
|
||||
<?php
|
||||
}else{
|
||||
?> <a href="banned.php" title="<?php echo FINISH_GOLD; ?>"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
echo "</b>";
|
||||
} else {
|
||||
|
||||
+10
-53
@@ -38,16 +38,8 @@ if (isset($_POST['name']) && !empty($_POST['name'])) {
|
||||
<td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo (2*$hero_info['attack'])+1; ?>px;" alt="<?php echo $hero_info['atk']; ?>" title="<?php echo $hero_info['atk']; ?>" /></td>
|
||||
<td class="up"><span class="none">
|
||||
<?php
|
||||
if($hero_info['points'] > 0 && $hero_info['attack'] < 100){
|
||||
if($session->access != BANNED){
|
||||
echo "<a href=\"build.php?id=".$id."&add=off\">(<b>+</b>)</a>";
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}else {
|
||||
echo "<span class=\"none\">(+)</span>";
|
||||
}
|
||||
if($hero_info['points'] > 0 && $hero_info['attack'] < 100) echo "<a href=\"build.php?id=".$id."&add=off\">(<b>+</b>)</a>";
|
||||
else echo "<span class=\"none\">(+)</span>";
|
||||
?>
|
||||
</td>
|
||||
<td class="po"><?php echo $hero_info['attack']; ?></td>
|
||||
@@ -58,16 +50,8 @@ if (isset($_POST['name']) && !empty($_POST['name'])) {
|
||||
<td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo (2*$hero_info['defence'])+1; ?>px;" alt="<?php echo ($hero_info['di']) . "/" . ($hero_info['dc']); ?>" title="<?php echo ($hero_info['di']) . "/" . ($hero_info['dc']); ?>" /></td>
|
||||
<td class="up"><span class="none">
|
||||
<?php
|
||||
if($hero_info['points'] > 0 && $hero_info['defence'] < 100){
|
||||
if($session->access != BANNED){
|
||||
echo "<a href=\"build.php?id=".$id."&add=deff\">(<b>+</b>)</a>";
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}else {
|
||||
echo "<span class=\"none\">(+)</span>";
|
||||
}
|
||||
if($hero_info['points'] > 0 && $hero_info['defence'] < 100) echo "<a href=\"build.php?id=".$id."&add=deff\">(<b>+</b>)</a>";
|
||||
else echo "<span class=\"none\">(+)</span>";
|
||||
?>
|
||||
</td>
|
||||
<td class="po"><?php echo $hero_info['defence']; ?></td>
|
||||
@@ -78,17 +62,8 @@ if (isset($_POST['name']) && !empty($_POST['name'])) {
|
||||
<td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo ($hero_info['ob']-1)*1000+1; ?>px;" alt="<?php echo ($hero_info['ob']-1)*100; ?>%" title="<?php echo ($hero_info['ob']-1)*100; ?>%" /></td>
|
||||
<td class="up"><span class="none">
|
||||
<?php
|
||||
if($hero_info['points'] > 0 && $hero_info['attackbonus'] < 100){
|
||||
if($session->access != BANNED){
|
||||
echo "<a href=\"build.php?id=".$id."&add=obonus\">(<b>+</b>)</a>";
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
}else {
|
||||
echo "<span class=\"none\">(+)</span>";
|
||||
}
|
||||
if($hero_info['points'] > 0 && $hero_info['attackbonus'] < 100) echo "<a href=\"build.php?id=".$id."&add=obonus\">(<b>+</b>)</a>";
|
||||
else echo "<span class=\"none\">(+)</span>";
|
||||
?>
|
||||
</td>
|
||||
<td class="po"><?php echo $hero_info['attackbonus']; ?></td>
|
||||
@@ -99,17 +74,8 @@ if (isset($_POST['name']) && !empty($_POST['name'])) {
|
||||
<td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo ($hero_info['db']-1)*1000+1; ?>px;" alt="<?php echo ($hero_info['db']-1)*100; ?>%" title="<?php echo ($hero_info['db']-1)*100; ?>%" /></td>
|
||||
<td class="up"><span class="none">
|
||||
<?php
|
||||
if($hero_info['points'] > 0 && $hero_info['defencebonus'] < 100){
|
||||
if($session->access != BANNED){
|
||||
echo "<a href=\"build.php?id=".$id."&add=dbonus\">(<b>+</b>)</a>";
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
}else {
|
||||
echo "<span class=\"none\">(+)</span>";
|
||||
}
|
||||
if($hero_info['points'] > 0 && $hero_info['defencebonus'] < 100) echo "<a href=\"build.php?id=".$id."&add=dbonus\">(<b>+</b>)</a>";
|
||||
else echo "<span class=\"none\">(+)</span>";
|
||||
?>
|
||||
</td>
|
||||
<td class="po"><?php echo $hero_info['defencebonus']; ?></td>
|
||||
@@ -120,17 +86,8 @@ if (isset($_POST['name']) && !empty($_POST['name'])) {
|
||||
<td class="xp"><img class="bar" src="img/x.gif" style="width:<?php echo ($hero_info['regeneration']*2)+1; ?>px;" alt="<?php echo ($hero_info['regeneration']*5*SPEED); ?>%/Day" title="<?php echo ($hero_info['regeneration']*5*SPEED); ?>%/Day" /></td>
|
||||
<td class="up"><span class="none">
|
||||
<?php
|
||||
if($hero_info['points'] > 0 && $hero_info['regeneration'] < 100){
|
||||
if($session->access != BANNED){
|
||||
echo "<a href=\"build.php?id=".$id."&add=reg\">(<b>+</b>)</a>";
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
}else {
|
||||
echo "<span class=\"none\">(+)</span>";
|
||||
}
|
||||
if($hero_info['points'] > 0 && $hero_info['regeneration'] < 100) echo "<a href=\"build.php?id=".$id."&add=reg\">(<b>+</b>)</a>";
|
||||
else echo "<span class=\"none\">(+)</span>";
|
||||
?>
|
||||
</td>
|
||||
<td class="po"><?php echo $hero_info['regeneration']; ?></td>
|
||||
|
||||
@@ -4,14 +4,9 @@
|
||||
|
||||
$oasisarray = $database->getOasis($village->wid);
|
||||
if(isset($_GET['gid']) && $_GET['gid'] == 37 && isset($_GET['del']) && $database->getOasisField($_GET['del'], 'owner') == $session->uid){
|
||||
if($session->access != BANNED){
|
||||
$database->removeOases($_GET['del']);
|
||||
header("Location: build.php?id=".$id."&land");
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<table id="oases" cellpadding="1" cellspacing="1">
|
||||
|
||||
@@ -141,15 +141,10 @@
|
||||
}
|
||||
|
||||
if(isset($_GET['revive']) && $_GET['revive'] == 1 && isset($_GET['hid']) && $_GET['hid'] == $hero_datarow['heroid'] && $hero_datarow['inrevive'] == 0 && $hero_datarow['intraining'] == 0 && $hero_datarow['dead'] == 1){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."hero SET `inrevive` = '1', `trainingtime` = '".(int) $training_time2."', `wref` = '".(int) $village->wid."' WHERE `heroid` = ".(int) $_GET['hid']." AND `uid` = '".(int) $session->uid."'");
|
||||
$database->modifyResource($village->wid, $wood, $clay, $iron, $crop, 0);
|
||||
header("Location: build.php?id=".$id."");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."hero SET `inrevive` = '1', `trainingtime` = '".(int) $training_time2."', `wref` = '".(int) $village->wid."' WHERE `heroid` = ".(int) $_GET['hid']." AND `uid` = '".(int) $session->uid."'");
|
||||
$database->modifyResource($village->wid, $wood, $clay, $iron, $crop, 0);
|
||||
header("Location: build.php?id=".$id."");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -647,12 +647,11 @@ $output.="<tr>
|
||||
|
||||
// check for a valid unit value
|
||||
if (in_array($_GET['train'], $validationArray)) {
|
||||
if($session->access != BANNED){
|
||||
if($count_hero < 3){
|
||||
$unitID = $_GET['train'];
|
||||
mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES (".$database->escape($session->uid).", " . (int) $village->wid . ", 0, ".$unitID.", '".$database->escape($session->username)."', 0, 5, 0, 0, 100, 0, 0, 0, 0, ".round((time() + (${'u'.$unitID}['time'] / SPEED)*3)).", 50, 1)");
|
||||
mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "units SET `u$unitID` = `u$unitID` - 1 WHERE `vref` = " . (int) $village->wid);
|
||||
mysqli_query($database->dblink,"
|
||||
if($count_hero < 3){
|
||||
$unitID = $_GET['train'];
|
||||
mysqli_query($database->dblink,"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES (".$database->escape($session->uid).", " . (int) $village->wid . ", 0, ".$unitID.", '".$database->escape($session->username)."', 0, 5, 0, 0, 100, 0, 0, 0, 0, ".round((time() + (${'u'.$unitID}['time'] / SPEED)*3)).", 50, 1)");
|
||||
mysqli_query($database->dblink,"UPDATE " . TB_PREFIX . "units SET `u$unitID` = `u$unitID` - 1 WHERE `vref` = " . (int) $village->wid);
|
||||
mysqli_query($database->dblink,"
|
||||
UPDATE " . TB_PREFIX . "vdata
|
||||
SET
|
||||
`wood` = `wood` - ".(int) ${'u'.$unitID}['wood'].",
|
||||
@@ -661,13 +660,9 @@ $output.="<tr>
|
||||
`crop` = `crop` - ".(int) ${'u'.$unitID}['crop']."
|
||||
WHERE
|
||||
`wref` = " . (int) $village->wid);
|
||||
}
|
||||
header("Location: build.php?id=".$id."");
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
header("Location: build.php?id=".$id."");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-12
@@ -17,29 +17,23 @@ $building->loadBuilding();
|
||||
<?php
|
||||
|
||||
if($session->gold >= 2) {
|
||||
if($session->access!=BANNED){
|
||||
?> <a href="?buildingFinish=1" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
|
||||
<?php
|
||||
}else{
|
||||
?> <a href="banned.php" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<a href="?buildingFinish=1" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$BuildingList = array();
|
||||
foreach($building->buildArray as $jobs) {
|
||||
if($jobs['master'] == 0){
|
||||
echo "<tr><td class=\"ico\"><a href=\"?d=".$jobs['id']."&a=0&c=$session->checker\">";
|
||||
echo "<img src=\"img/x.gif\" class=\"del\" title=\"cancel\" alt=\"cancel\" /></a></td><td>";
|
||||
echo Building::procResType($jobs['type'])." (Level ".$jobs['level'].")";
|
||||
if($jobs['loopcon'] == 0) { $BuildingList[] = $jobs['field']; }
|
||||
if($jobs['loopcon'] == 1) {
|
||||
echo " (waiting loop)";
|
||||
}
|
||||
|
||||
if($jobs['loopcon'] == 1) echo " (waiting loop)";
|
||||
|
||||
echo "</td><td>in <span id=\"timer".++$session->timer."\">";
|
||||
echo $generator->getTimeFormat($jobs['timestamp']-time());
|
||||
echo "</span> hrs.</td>";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan, improved by evader /////////////////////////
|
||||
if($session->access != BANNED && $session->gold >= 5){
|
||||
if($session->gold >= 5){
|
||||
$MyGold = mysqli_query($database->dblink,"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) {
|
||||
@@ -24,8 +24,5 @@ if($session->access != BANNED && $session->gold >= 5){
|
||||
}
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan, improved by evader /////////////////////////
|
||||
if($session->access != BANNED && $session->gold >= 5){
|
||||
if($session->gold >= 5){
|
||||
$MyGold = mysqli_query($database->dblink,"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) {
|
||||
@@ -24,8 +24,5 @@ if($session->access != BANNED && $session->gold >= 5){
|
||||
}
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan, improved by evader /////////////////////////
|
||||
if($session->access != BANNED && $session->gold >= 5){
|
||||
if($session->gold >= 5){
|
||||
$MyGold = mysqli_query($database->dblink,"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) {
|
||||
@@ -24,8 +24,5 @@ if($session->access != BANNED && $session->gold >= 5){
|
||||
}
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan /////////////////////////
|
||||
if($session->access != BANNED){
|
||||
|
||||
$MyVilId = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."vdata WHERE `wref`='".$village->wid."'") or die(mysqli_error($database->dblink));
|
||||
$uuVilid = mysqli_fetch_array($MyVilId);
|
||||
|
||||
@@ -25,8 +25,5 @@ echo "failed";
|
||||
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,14 +1,8 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan /////////////////////////
|
||||
if($session->access != BANNED){
|
||||
if($session->gold >= 100 && $session->sit == 0 && $session->goldclub == 0) {
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set goldclub = 1, gold = gold - 100 where `id`='".$session->uid."'");
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set goldclub = 1, gold = gold - 100 where `id`='".$session->uid."'");
|
||||
}
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
+24
-26
@@ -1,22 +1,19 @@
|
||||
<?php
|
||||
|
||||
$MyGold = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
||||
$golds = mysqli_fetch_array($MyGold);
|
||||
$MyGold = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
||||
$golds = mysqli_fetch_array($MyGold);
|
||||
|
||||
include("Templates/Plus/pmenu.tpl");
|
||||
|
||||
|
||||
$MyGold = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
||||
$golds = mysqli_fetch_array($MyGold);
|
||||
$MyGold = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."users WHERE `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
||||
$golds = mysqli_fetch_array($MyGold);
|
||||
|
||||
$today = date("mdHi");
|
||||
$today = date("mdHi");
|
||||
|
||||
if (mysqli_num_rows($MyGold)) {
|
||||
if($session->gold == 0) {
|
||||
echo "<p>You currently don't own gold.</p>";
|
||||
} else {
|
||||
echo "<p>You currently have <b> $session->gold </b> gold</p>";
|
||||
}
|
||||
if(mysqli_num_rows($MyGold)){
|
||||
if($session->gold == 0) echo "<p>You currently don't own gold.</p>";
|
||||
else echo "<p>You currently have <b> $session->gold </b> gold</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -44,24 +41,25 @@ if (mysqli_num_rows($MyGold)) {
|
||||
<b><font color="#71D000">P</font><font color="#FF6F0F">l</font><font color="#71D000">u</font><font color="#FF6F0F">s</font></b> Account<br />
|
||||
<span class="run">
|
||||
<?php
|
||||
$datetimep=$golds['plus'];
|
||||
$datetime1=$golds['b1'];
|
||||
$datetime2=$golds['b2'];
|
||||
$datetime3=$golds['b3'];
|
||||
$datetime4=$golds['b4'];
|
||||
$datetimeap=$golds['ap'];
|
||||
$datetimedp=$golds['dp'];
|
||||
$datetimep = $golds['plus'];
|
||||
$datetime1 = $golds['b1'];
|
||||
$datetime2 = $golds['b2'];
|
||||
$datetime3 = $golds['b3'];
|
||||
$datetime4 = $golds['b4'];
|
||||
$datetimeap = $golds['ap'];
|
||||
$datetimedp = $golds['dp'];
|
||||
|
||||
//Retrieve the current date/time
|
||||
$date2=strtotime("NOW");
|
||||
$date2 = strtotime("NOW");
|
||||
|
||||
|
||||
if ($datetimep == 0) {
|
||||
print "get PLUS<br>";
|
||||
}else
|
||||
if ($datetimep <= $date2) {
|
||||
print "Your PLUS advantage has ended.<br>";
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set plus = '0' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
||||
} else {
|
||||
if ($datetimep == 0) echo "get PLUS<br>";
|
||||
else
|
||||
{
|
||||
if ($datetimep <= $date2) {
|
||||
print "Your PLUS advantage has ended.<br>";
|
||||
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."users set plus = '0' where `id`='".$session->uid."'") or die(mysqli_error($database->dblink));
|
||||
} else {
|
||||
|
||||
$holdtotmin=(($datetimep-$date2)/60);
|
||||
$holdtothr=(($datetimep-$date2)/3600);
|
||||
|
||||
@@ -12,12 +12,7 @@ include("Templates/Plus/pmenu.tpl");
|
||||
<h2>How is it done?</h2>
|
||||
|
||||
<h3>1) Invite your friends via Email</h3>
|
||||
<?php if($session->access != BANNED){ ?>
|
||||
<p><a href="plus.php?id=5&a=1&mail">» Invite by e-mail</a></p>
|
||||
|
||||
<?php }else{ ?>
|
||||
<p><a href="banned.php">» Invite by e-mail</a></p>
|
||||
<?php } ?>
|
||||
<h3>2) Copy your personal REF-Link and share it!</h3><span class="notice">Your personal REF Link:</span>
|
||||
<br>
|
||||
<span class="link"><?php echo HOMEPAGE.(substr(HOMEPAGE, -1)=="/" ? "":"/");?>anmelden.php?uid=ref_<?php echo $session->uid; ?></span>
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
<?php
|
||||
if($session->access!=BANNED){
|
||||
$building->finishAll('plus.php?id=3');
|
||||
exit;
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
<?php
|
||||
$building->finishAll('plus.php?id=3');
|
||||
exit;
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan, improved by evader /////////////////////////
|
||||
if($session->access != BANNED && $session->gold >= 10){
|
||||
if($session->gold >= 10){
|
||||
$MyGold = mysqli_query($database->dblink,"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) {
|
||||
@@ -24,8 +24,5 @@ if($session->access != BANNED && $session->gold >= 10){
|
||||
}
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
////////////// made by alq0rsan, improved by evader /////////////////////////
|
||||
if($session->access != BANNED && $session->gold >= 5){
|
||||
if($session->gold >= 5){
|
||||
$MyGold = mysqli_query($database->dblink,"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) {
|
||||
@@ -24,8 +24,5 @@ if($session->access != BANNED && $session->gold >= 5){
|
||||
}
|
||||
header("Location: plus.php?id=3");
|
||||
exit;
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -12,7 +12,6 @@ include("Templates/Plus/pmenu.tpl");
|
||||
<h2>How is it done?</h2>
|
||||
|
||||
<h3>1) Invite your friends via Email</h3>
|
||||
<?php if($session->access != BANNED){ ?>
|
||||
<form action="plus.php" method="POST">
|
||||
<p><input class="mail" name="mail" value=""></p>
|
||||
<p>Own text:</p>
|
||||
@@ -21,9 +20,6 @@ hi, please use this link.
|
||||
<?php echo HOMEPAGE.(substr(HOMEPAGE, -1)=="/" ? "":"/"); ?>anmelden.php?uid=ref_<?php echo $session->uid; ?>
|
||||
</textarea></p>
|
||||
</form>
|
||||
<?php }else{ ?>
|
||||
<p><a href="banned.php">» Invite by e-mail</a></p>
|
||||
<?php } ?>
|
||||
<h3>2) Copy your personal REF-Link and share it!</h3><span class="notice">Your personal REF Link:</span>
|
||||
<br>
|
||||
<span class="link"><?php echo HOMEPAGE.(substr(HOMEPAGE, -1)=="/" ? "":"/");?>anmelden.php?uid=ref_<?php echo $session->uid; ?></span>
|
||||
|
||||
@@ -20,75 +20,68 @@ if(isset($_GET['del']) && is_numeric($_GET['del'])){
|
||||
#################################################################################
|
||||
// Save new link or just edit a link
|
||||
if($_POST) {
|
||||
$links = array();
|
||||
$links = [];
|
||||
|
||||
// let's do some complicated code x'D
|
||||
foreach($_POST as $key => $value) {
|
||||
if(substr($key, 0, 2) == 'nr') {
|
||||
$i = substr($key, 2);
|
||||
$links[$i]['nr'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
|
||||
if(substr($key, 0, 2) == 'id') {
|
||||
$i = substr($key, 2);
|
||||
$links[$i]['id'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
|
||||
if(substr($key, 0, 8) == 'linkname') {
|
||||
$i = substr($key, 8);
|
||||
$links[$i]['linkname'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
|
||||
if(substr($key, 0, 8) == 'linkziel') {
|
||||
$i = substr($key, 8);
|
||||
$links[$i]['linkziel'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
if(substr($key, 0, 2) == 'nr') {
|
||||
$i = substr($key, 2);
|
||||
$links[$i]['nr'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
|
||||
if(substr($key, 0, 2) == 'id') {
|
||||
$i = substr($key, 2);
|
||||
$links[$i]['id'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
|
||||
if(substr($key, 0, 8) == 'linkname') {
|
||||
$i = substr($key, 8);
|
||||
$links[$i]['linkname'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
|
||||
if(substr($key, 0, 8) == 'linkziel') {
|
||||
$i = substr($key, 8);
|
||||
$links[$i]['linkziel'] = mysqli_real_escape_string($database->dblink, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// Save
|
||||
foreach($links as $link) {
|
||||
settype($link['nr'], 'int');
|
||||
|
||||
if(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) == '') {
|
||||
// Add new link
|
||||
$userid = (int) $session->uid;
|
||||
if($session->access!=BANNED){
|
||||
$query = mysqli_query($database->dblink,'INSERT INTO `' . TB_PREFIX . 'links` (`userid`, `name`, `url`, `pos`) VALUES (' . $userid . ', \'' . $link['linkname'] . '\', \'' . $link['linkziel'] . '\', ' . $link['nr'] . ')');
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
} elseif(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) != '') {
|
||||
// Update link
|
||||
$query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
|
||||
$data = mysqli_fetch_assoc($query);
|
||||
|
||||
// May the user update this entry?
|
||||
if($data['userid'] == $session->uid) {
|
||||
$query2 = mysqli_query($database->dblink,'UPDATE `' . TB_PREFIX . 'links` SET `name` = \'' . $link['linkname'] . '\', `url` = \'' . $link['linkziel'] . '\', `pos` = ' . $link['nr'] . ' WHERE `id` = ' . $link['id']);
|
||||
}
|
||||
} elseif(trim($link['nr']) == '' AND trim($link['linkname']) == '' AND trim($link['linkziel']) == '' AND trim($link['id']) != '') {
|
||||
// Delete entry
|
||||
$query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
|
||||
$data = mysqli_fetch_assoc($query);
|
||||
|
||||
// May the user delete this entry?
|
||||
if($data['userid'] == $session->uid) {
|
||||
$query2 = mysqli_query($database->dblink,'DELETE FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
|
||||
}
|
||||
}
|
||||
settype($link['nr'], 'int');
|
||||
|
||||
if(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) == '') {
|
||||
// Add new link
|
||||
$userid = (int) $session->uid;
|
||||
$query = mysqli_query($database->dblink,'INSERT INTO `' . TB_PREFIX . 'links` (`userid`, `name`, `url`, `pos`) VALUES (' . $userid . ', \'' . $link['linkname'] . '\', \'' . $link['linkziel'] . '\', ' . $link['nr'] . ')');
|
||||
|
||||
} elseif(trim($link['nr']) != '' AND trim($link['linkname']) != '' AND trim($link['linkziel']) != '' AND trim($link['id']) != '') {
|
||||
// Update link
|
||||
$query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
|
||||
$data = mysqli_fetch_assoc($query);
|
||||
|
||||
// May the user update this entry?
|
||||
if($data['userid'] == $session->uid) {
|
||||
$query2 = mysqli_query($database->dblink,'UPDATE `' . TB_PREFIX . 'links` SET `name` = \'' . $link['linkname'] . '\', `url` = \'' . $link['linkziel'] . '\', `pos` = ' . $link['nr'] . ' WHERE `id` = ' . $link['id']);
|
||||
}
|
||||
} elseif(trim($link['nr']) == '' AND trim($link['linkname']) == '' AND trim($link['linkziel']) == '' AND trim($link['id']) != '') {
|
||||
// Delete entry
|
||||
$query = mysqli_query($database->dblink,'SELECT userid FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
|
||||
$data = mysqli_fetch_assoc($query);
|
||||
|
||||
// May the user delete this entry?
|
||||
if($data['userid'] == $session->uid) {
|
||||
$query2 = mysqli_query($database->dblink,'DELETE FROM `' . TB_PREFIX . 'links` WHERE `id` = ' . $link['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<meta http-equiv="refresh" content="0">';
|
||||
echo '<meta http-equiv="refresh" content="0">';
|
||||
}
|
||||
|
||||
|
||||
// Fetch all links
|
||||
$query = mysqli_query($database->dblink,'SELECT * FROM `' . TB_PREFIX . 'links` WHERE `userid` = ' . (int) $session->uid . ' ORDER BY `pos` ASC') or die(mysqli_error($database->dblink));
|
||||
$links = array();
|
||||
while($data = mysqli_fetch_assoc($query)) {
|
||||
$links[] = $data;
|
||||
}
|
||||
$links = [];
|
||||
while($data = mysqli_fetch_assoc($query)) $links[] = $data;
|
||||
?>
|
||||
|
||||
<h1>Player profile</h1>
|
||||
|
||||
@@ -71,120 +71,94 @@ if ($session->goldclub == 1 && count($session->villages) > 1) {
|
||||
if (isset($_POST['routeid'])) $routeid = $_POST['routeid'];
|
||||
|
||||
if (isset($_POST['action']) && $_POST['action'] == 'addRoute') {
|
||||
if ($session->access != BANNED) {
|
||||
if ($session->gold >= 2 && $session->goldclub == 1) {
|
||||
for ($i = 1; $i <= 4; $i ++) {
|
||||
if (empty($_POST['r'.$i])) {
|
||||
$_POST['r'.$i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$totalres = preg_replace("/[^0-9]/", "", $_POST['r1']) + preg_replace("/[^0-9]/", "", $_POST['r2']) + preg_replace("/[^0-9]/", "", $_POST['r3']) + preg_replace("/[^0-9]/", "", $_POST['r4']);
|
||||
$reqMerc = ceil(($totalres - 0.1) / $market->maxcarry);
|
||||
$second = date("s");
|
||||
$minute = date("i");
|
||||
$hour = date("G") - $_POST['start'];
|
||||
|
||||
if (date("G") > $_POST['start']) $day = 1;
|
||||
else $day = 0;
|
||||
|
||||
$timestamp = strtotime("-$hour hours -$second second -$minute minutes +$day day");
|
||||
|
||||
if ($totalres > 0 && $_POST['tvillage'] != $village->wid && in_array($_POST['tvillage'], $session->villages) && ($_POST['start'] >= 0 && $_POST['start'] <= 23) && ($_POST['deliveries'] >= 1 && $_POST['deliveries'] <= 3)) {
|
||||
$database->createTradeRoute($session->uid, $_POST['tvillage'], $village->wid, $_POST['r1'], $_POST['r2'], $_POST['r3'], $_POST['r4'], $_POST['start'], $_POST['deliveries'], $reqMerc, $timestamp);
|
||||
$route = 1;
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
} else {
|
||||
$route = 1;
|
||||
header("Location: build.php?gid=17&t=4&create");
|
||||
exit;
|
||||
}
|
||||
if ($session->gold >= 2 && $session->goldclub == 1) {
|
||||
for ($i = 1; $i <= 4; $i ++) {
|
||||
if (empty($_POST['r'.$i])) $_POST['r'.$i] = 0;
|
||||
}
|
||||
|
||||
$totalres = preg_replace("/[^0-9]/", "", $_POST['r1']) + preg_replace("/[^0-9]/", "", $_POST['r2']) + preg_replace("/[^0-9]/", "", $_POST['r3']) + preg_replace("/[^0-9]/", "", $_POST['r4']);
|
||||
$reqMerc = ceil(($totalres - 0.1) / $market->maxcarry);
|
||||
$second = date("s");
|
||||
$minute = date("i");
|
||||
$hour = date("G") - $_POST['start'];
|
||||
|
||||
if (date("G") > $_POST['start']) $day = 1;
|
||||
else $day = 0;
|
||||
|
||||
$timestamp = strtotime("-$hour hours -$second second -$minute minutes +$day day");
|
||||
|
||||
if ($totalres > 0 && $_POST['tvillage'] != $village->wid && in_array($_POST['tvillage'], $session->villages) && ($_POST['start'] >= 0 && $_POST['start'] <= 23) && ($_POST['deliveries'] >= 1 && $_POST['deliveries'] <= 3)) {
|
||||
$database->createTradeRoute($session->uid, $_POST['tvillage'], $village->wid, $_POST['r1'], $_POST['r2'], $_POST['r3'], $_POST['r4'], $_POST['start'], $_POST['deliveries'], $reqMerc, $timestamp);
|
||||
$route = 1;
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
} else {
|
||||
$route = 1;
|
||||
header("Location: build.php?gid=17&t=4&create");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['routeid']) && isset($_POST['action']) && $_POST['action'] == 'extendRoute') {
|
||||
if ($session->access != BANNED) {
|
||||
if ($session->gold >= 2 && $session->goldclub == 1) {
|
||||
$traderoute = $database->getTradeRouteUid($_POST['routeid']);
|
||||
if ($traderoute == $session->uid) {
|
||||
$database->editTradeRoute($_POST['routeid'], "timeleft", 604800, 1);
|
||||
$newgold = $session->gold - 2;
|
||||
$database->updateUserField($session->uid, 'gold', $newgold, 1);
|
||||
if ($session->gold >= 2 && $session->goldclub == 1) {
|
||||
$traderoute = $database->getTradeRouteUid($_POST['routeid']);
|
||||
if ($traderoute == $session->uid) {
|
||||
$database->editTradeRoute($_POST['routeid'], "timeleft", 604800, 1);
|
||||
$newgold = $session->gold - 2;
|
||||
$database->updateUserField($session->uid, 'gold', $newgold, 1);
|
||||
}
|
||||
}
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['routeid']) && isset($_POST['action']) && $_POST['action'] == 'editRoute2') {
|
||||
if($session->goldclub == 1){
|
||||
for ($i = 1; $i <= 4; $i ++) {
|
||||
if (empty($_POST['r'.$i])) {
|
||||
$_POST['r'.$i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$totalres = preg_replace("/[^0-9]/", "", $_POST['r1']) + preg_replace("/[^0-9]/", "", $_POST['r2']) + preg_replace("/[^0-9]/", "", $_POST['r3']) + preg_replace("/[^0-9]/", "", $_POST['r4']);
|
||||
$reqMerc = ceil(($totalres - 0.1) / $market->maxcarry);
|
||||
|
||||
$traderoute = $database->getTradeRouteUid($_POST['routeid']);
|
||||
if ($totalres > 0 && $traderoute == $session->uid && ($_POST['start'] >= 0 && $_POST['start'] <= 23) && ($_POST['deliveries'] >= 1 && $_POST['deliveries'] <= 3)) {
|
||||
$database->editTradeRoute($_POST['routeid'], "wood", $_POST['r1'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "clay", $_POST['r2'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "iron", $_POST['r3'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "crop", $_POST['r4'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "start", $_POST['start'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "deliveries", $_POST['deliveries'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "merchant", $reqMerc, 0);
|
||||
$second = date("s");
|
||||
$minute = date("i");
|
||||
$hour = date("G") - $_POST['start'];
|
||||
if (date("G") > $_POST['start']) $day = 1;
|
||||
else $day = 0;
|
||||
$timestamp = strtotime("-$hour hours -$second seconds -$minute minutes +$day day");
|
||||
$database->editTradeRoute($_POST['routeid'], "timestamp", $timestamp, 0);
|
||||
}
|
||||
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
} else {
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['routeid']) && isset($_POST['action']) && $_POST['action'] == 'editRoute2') {
|
||||
if ($session->access != BANNED) {
|
||||
if($session->goldclub == 1){
|
||||
for ($i = 1; $i <= 4; $i ++) {
|
||||
if (empty($_POST['r'.$i])) {
|
||||
$_POST['r'.$i] = 0;
|
||||
}
|
||||
}
|
||||
$totalres = preg_replace("/[^0-9]/", "", $_POST['r1']) + preg_replace("/[^0-9]/", "", $_POST['r2']) + preg_replace("/[^0-9]/", "", $_POST['r3']) + preg_replace("/[^0-9]/", "", $_POST['r4']);
|
||||
$reqMerc = ceil(($totalres - 0.1) / $market->maxcarry);
|
||||
|
||||
$traderoute = $database->getTradeRouteUid($_POST['routeid']);
|
||||
if ($totalres > 0 && $traderoute == $session->uid && ($_POST['start'] >= 0 && $_POST['start'] <= 23) && ($_POST['deliveries'] >= 1 && $_POST['deliveries'] <= 3)) {
|
||||
$database->editTradeRoute($_POST['routeid'], "wood", $_POST['r1'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "clay", $_POST['r2'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "iron", $_POST['r3'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "crop", $_POST['r4'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "start", $_POST['start'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "deliveries", $_POST['deliveries'], 0);
|
||||
$database->editTradeRoute($_POST['routeid'], "merchant", $reqMerc, 0);
|
||||
$second = date("s");
|
||||
$minute = date("i");
|
||||
$hour = date("G") - $_POST['start'];
|
||||
if (date("G") > $_POST['start']) $day = 1;
|
||||
else $day = 0;
|
||||
$timestamp = strtotime("-$hour hours -$second seconds -$minute minutes +$day day");
|
||||
$database->editTradeRoute($_POST['routeid'], "timestamp", $timestamp, 0);
|
||||
}
|
||||
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
} else {
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['routeid']) && isset($_POST['action']) && $_POST['action'] == 'delRoute') {
|
||||
if ($session->access != BANNED ) {
|
||||
if($session->goldclub == 1){
|
||||
$traderoute = $database->getTradeRouteUid($_POST['routeid']);
|
||||
if ($traderoute == $session->uid) $database->deleteTradeRoute($_POST['routeid']);
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
} else {
|
||||
$route = 0;
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($session->goldclub == 1){
|
||||
$traderoute = $database->getTradeRouteUid($_POST['routeid']);
|
||||
if ($traderoute == $session->uid) $database->deleteTradeRoute($_POST['routeid']);
|
||||
$route = 1;
|
||||
unset($routeid);
|
||||
header("Location: build.php?gid=17&t=4");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,14 +186,7 @@ if ($session->goldclub == 1) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($_POST['action']) && $_POST['action'] == 'startRaid') {
|
||||
if($session->access != BANNED) $units->startRaidList($_POST);
|
||||
else
|
||||
{
|
||||
header( "Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if(isset($_POST['action']) && $_POST['action'] == 'startRaid') $units->startRaidList($_POST);
|
||||
|
||||
if(isset($_GET['slid']) && is_numeric($_GET['slid'])) {
|
||||
$FLData = $database->getFLData($_GET['slid']);
|
||||
@@ -243,37 +210,25 @@ if ($session->goldclub == 1) {
|
||||
}
|
||||
else $create = 0;
|
||||
|
||||
if(isset($_POST['a']) == 533374 && isset($_POST['id']) == 39) {
|
||||
if($session->access != BANNED) $units->Settlers($_POST);
|
||||
else
|
||||
{
|
||||
header( "Location: banned.php" );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if(isset($_POST['a']) == 533374 && isset($_POST['id']) == 39) $units->Settlers($_POST);
|
||||
|
||||
if(isset($_GET['mode']) && $_GET['mode'] == 'troops' && isset($_GET['cancel']) && $_GET['cancel'] == 1){
|
||||
if($session->access != BANNED){
|
||||
$oldmovement = $database->getMovementById($_GET['moveid']);
|
||||
$now = time();
|
||||
if(($now - $oldmovement[0]['starttime']) < 90 && $oldmovement[0]['from'] == $village->wid){
|
||||
$qc = "SELECT Count(*) as Total FROM " . TB_PREFIX . "movement where proc = 0 and moveid = " . $database->escape((int)$_GET['moveid']);
|
||||
$resultc = mysqli_fetch_array(mysqli_query($database->dblink, $qc), MYSQLI_ASSOC);
|
||||
if($resultc['Total'] == 1){
|
||||
$q = "UPDATE " . TB_PREFIX . "movement set proc = 1 where proc = 0 and moveid = " . $database->escape((int)$_GET['moveid']);
|
||||
$database->query($q);
|
||||
$end = $now + ($now - $oldmovement[0]['starttime']);
|
||||
$q2 = "SELECT id FROM " . TB_PREFIX . "send ORDER BY id DESC";
|
||||
$lastid = mysqli_fetch_array(mysqli_query($database->dblink, $q2));
|
||||
$database->addMovement(4, $oldmovement[0]['to'], $oldmovement[0]['from'], $oldmovement[0]['ref'], $now, $end);
|
||||
}
|
||||
}
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $_GET['id']);
|
||||
exit();
|
||||
}else{
|
||||
header("Location: banned.php");
|
||||
exit();
|
||||
}
|
||||
$oldmovement = $database->getMovementById($_GET['moveid']);
|
||||
$now = time();
|
||||
if(($now - $oldmovement[0]['starttime']) < 90 && $oldmovement[0]['from'] == $village->wid){
|
||||
$qc = "SELECT Count(*) as Total FROM " . TB_PREFIX . "movement where proc = 0 and moveid = " . $database->escape((int)$_GET['moveid']);
|
||||
$resultc = mysqli_fetch_array(mysqli_query($database->dblink, $qc), MYSQLI_ASSOC);
|
||||
if($resultc['Total'] == 1){
|
||||
$q = "UPDATE " . TB_PREFIX . "movement set proc = 1 where proc = 0 and moveid = " . $database->escape((int)$_GET['moveid']);
|
||||
$database->query($q);
|
||||
$end = $now + ($now - $oldmovement[0]['starttime']);
|
||||
$q2 = "SELECT id FROM " . TB_PREFIX . "send ORDER BY id DESC";
|
||||
$lastid = mysqli_fetch_array(mysqli_query($database->dblink, $q2));
|
||||
$database->addMovement(4, $oldmovement[0]['to'], $oldmovement[0]['from'], $oldmovement[0]['ref'], $now, $end);
|
||||
}
|
||||
}
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $_GET['id']);
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+2
-6
@@ -5,7 +5,7 @@ $start_timer = $generator->pageLoadTimeStart();
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename banned.php ##
|
||||
## Filename packages.php ##
|
||||
## Developed by: yi12345 ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
@@ -17,7 +17,6 @@ include_once("GameEngine/Village.php");
|
||||
AccessLogger::logRequest();
|
||||
|
||||
$id = $_GET['id'];
|
||||
if($session->access != BANNED){
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
@@ -111,7 +110,4 @@ echo round(($generator->pageLoadTimeEnd()-$start_timer)*1000);
|
||||
|
||||
<div id="ce"></div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
else{header("Location: banned.php");exit;}?>
|
||||
</html>
|
||||
Reference in New Issue
Block a user