diff --git a/GameEngine/Account.php b/GameEngine/Account.php index b2cc1e9d..a1fee486 100755 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -5,15 +5,15 @@ use App\Entity\User; ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Project: TravianZ ## -## Version: 22.06.2015 ## +## Version: 22.06.2015 ## ## Filename Account.php ## -## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## +## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## ## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ## ## Fixed by: InCube - double troops ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2015. All rights reserved. ## ## URLs: http://travian.shadowss.ro ## -## Source code: https://github.com/Shadowss/TravianZ ## +## Source code: https://github.com/Shadowss/TravianZ ## ## ## ################################################################################# @@ -29,7 +29,7 @@ for ($i = 0; $i < 5; $i++) { } } -include($autoprefix."GameEngine/Session.php"); +include_once($autoprefix."GameEngine/Session.php"); class Account { @@ -113,7 +113,7 @@ class Account { $form->addError("invt",$_POST['invited']); $_SESSION['errorarray'] = $form->getErrors(); $_SESSION['valuearray'] = $_POST; - + header("Location: anmelden.php"); exit; @@ -277,7 +277,7 @@ class Account { $database->addTech($wid); $database->addABTech($wid); $database->updateUserField($uid,"access",USER,1); - + $message = new Message(); $message->sendWelcome($uid,$username); } diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 11bc8eb1..6d796fdd 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -1191,13 +1191,19 @@ class MYSQLi_DB implements IDbConnection { } function updateActiveUser($username, $time) { + static $updated = false; + + if ($updated) { + return; + } + list($username, $time) = $this->escape_input($username, $time); - $q = "REPLACE into " . TB_PREFIX . "active values ('$username',$time)"; - $q2 = "UPDATE " . TB_PREFIX . "users set timestamp = $time where username = '$username'"; - $exec1 = mysqli_query($this->dblink,$q); - $exec2 = mysqli_query($this->dblink,$q2); - if($exec1 && $exec2) { + $res1 = $this->addActiveUser($username, $time); + $q = "UPDATE " . TB_PREFIX . "users set timestamp = $time where username = '$username'"; + $res2 = mysqli_query($this->dblink,$q); + if($res1 && $res2) { + $updated = true; return true; } else { return false; diff --git a/GameEngine/Session.php b/GameEngine/Session.php index 4c6569a4..86fde02b 100755 --- a/GameEngine/Session.php +++ b/GameEngine/Session.php @@ -8,15 +8,15 @@ mb_internal_encoding("UTF-8"); // Add for utf8 varriables. ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Project: TravianZ ## -## Version: 22.06.2015 ## +## Version: 22.06.2015 ## ## Filename Session.php ## -## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## +## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## ## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ## ## Fixed by: InCube - double troops ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2015. All rights reserved. ## ## URLs: http://travian.shadowss.ro ## -## Source code: https://github.com/Shadowss/TravianZ ## +## Source code: https://github.com/Shadowss/TravianZ ## ## ## ################################################################################# @@ -127,8 +127,8 @@ class Session { $_SESSION['wid'] = $data['wref']; } $this->PopulateVar(); - - $database->addActiveUser($user_sanitized, $this->time); + + $database->updateActiveUser($user_sanitized, $this->time); $database->updateUserField($user_sanitized, "sessid", $_SESSION['sessid'], 0); } @@ -177,7 +177,7 @@ class Session { $id = (int) $_SESSION['id']; $admin = true; } - + if($user && ($admin || isset($_SESSION['sessid']))) { // check if this is not a support user, for who only messages and statistics are available if ($user == 1) { @@ -191,14 +191,14 @@ class Session { //Get and Populate Data $this->PopulateVar(); //update database - $database->addActiveUser($user, $this->time); + $database->updateActiveUser($user, $this->time); $database->updateUserField($user, "timestamp", $this->time, 0); return true; } else { return false; } } - + /*************************** Function to check Real Hero @@ -300,7 +300,7 @@ $form = new Form; // if there is no user, we'd try to load messages for user with ID 0, which is wrong if (!empty($_SESSION['id_user'])) { $message = new Message; - + // create a global user variable which will later be removed from here // and created + retrieved either via Service Locator or other DI concept $user = new User((int) $_SESSION['id_user'], $database); diff --git a/GameEngine/Village.php b/GameEngine/Village.php index 9994d224..11ac577a 100755 --- a/GameEngine/Village.php +++ b/GameEngine/Village.php @@ -9,11 +9,11 @@ ## ## ################################################################################# -include("Session.php"); -include("Building.php"); -include("Market.php"); +include_once("Session.php"); +include_once("Building.php"); +include_once("Market.php"); include_once("GameEngine/Units.php"); -include("Technology.php"); +include_once("Technology.php"); class Village { @@ -30,7 +30,7 @@ class Village { function __construct() { global $session, $database; if(isset($_SESSION['wid'])) { - $this->wid = $_SESSION['wid']; + $this->wid = $_SESSION['wid']; } else { $this->wid = $session->villages[0]; diff --git a/Templates/Ajax/plusmap.tpl b/Templates/Ajax/plusmap.tpl index e8a5041d..e757d845 100644 --- a/Templates/Ajax/plusmap.tpl +++ b/Templates/Ajax/plusmap.tpl @@ -1,5 +1,5 @@ -getCoor($z); $y = $currentcoor['y']; @@ -68,7 +68,7 @@ for($i=0;$i<=12;$i++) { } if($row1 != 13 && $i != 12) { echo "\\n"; - } + } $index+=1; } echo "<\\/div>