From a934c569bd8bbba4d80ed178d34242da15c6f66d Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 20 Feb 2019 00:04:19 +0100 Subject: [PATCH] Bug Fixes +Optimized a bad query, that took a lot of time to be executed --- GameEngine/Database.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 05b2175f..3ba4249a 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -785,9 +785,13 @@ function updateResource($vid, $what, $number) { // no need to cache this method public function hasBeginnerProtection($vid) { - list($vid) = $this->escape_input($vid); - - $q = "SELECT u.protect FROM ".TB_PREFIX."users u,".TB_PREFIX."vdata v,".TB_PREFIX."odata o WHERE (u.id = v.owner AND v.wref = ".(int) $vid.") OR (u.id = o.owner AND o.wref = ".(int) $vid.") LIMIT 1"; + list($vid) = $this->escape_input((int) $vid); + $q = "SELECT u.protect + FROM s1_users u + JOIN s1_vdata v ON u.id = v.owner + JOIN s1_odata o ON u.id = o.owner + WHERE v.wref = ". $vid ." OR o.wref = ". $vid . " + LIMIT 1"; $result = mysqli_query($this->dblink,$q); $dbarray = mysqli_fetch_array($result);