From 7403516aab2be57d6cae6cbd4595b6b569ea100e Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Thu, 30 Jan 2014 01:13:58 +0100 Subject: [PATCH] Added extra machine data to Utils::getUniqueID() --- src/PocketMinecraftServer.php | 2 +- src/utils/Utils.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index d3cc36416..173ac144a 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -36,7 +36,7 @@ class PocketMinecraftServer{ }*/ console("[INFO] Starting Minecraft PE server on ".($this->serverip === "0.0.0.0" ? "*":$this->serverip).":".$this->port); define("BOOTUP_RANDOM", Utils::getRandomBytes(16)); - $this->serverID = $this->serverID === false ? Utils::readLong(substr(Utils::getUniqueID(true), 8)):$this->serverID; + $this->serverID = $this->serverID === false ? Utils::readLong(substr(Utils::getUniqueID(true, $this->serverip . $this->port), 8)):$this->serverID; $this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):$this->seed; $this->startDatabase(); $this->api = false; diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 8836d0160..62faeb2f8 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -31,10 +31,11 @@ class Utils{ return ((@fsockopen("google.com", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.linux.org", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.php.net", 80, $e = null, $n = null, 2) !== false) ? true:false); } - public static function getUniqueID($raw = false){ + public static function getUniqueID($raw = false, $extra = ""){ $machine = php_uname("a"); $machine .= file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : ""; $machine .= sys_get_temp_dir(); + $machine .= $extra; if(Utils::getOS() == "win"){ exec("ipconfig /ALL", $mac); $mac = implode("\n", $mac);