From 72599065a94105c1d16be77908d188f9a88d308e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 12:26:02 +0100 Subject: [PATCH] fix: disallow building non-existing buildings --- GameEngine/Building.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 94c0808c..33e327ab 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -76,6 +76,8 @@ class Building { $page = basename($_SERVER['SCRIPT_NAME']); $levels = $database->getResourceLevel($village->wid); if ( + // 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 ( @@ -120,6 +122,14 @@ class Building { } if(isset($get['master']) && isset($get['id']) && isset($get['time']) && $session->gold >= 1 && $session->goldclub && $village->master == 0 && (isset($get['c']) && $get['c']== $session->checker)) { + // determine the timestamp of last of all the current upgrades + $t = 0; + foreach ($this->buildArray as $key) { + if ($key['timestamp'] > $t) { + $t = $key['timestamp']; + } + } + $m=$get['master']; $master = $_GET; $session->changeChecker();