diff --git a/README.md b/README.md index 98ab1c5..0a10c10 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ Just pass your serial and restore code on the command line : I'm using this on a little project of mine, an [Online Authenticator for Battle.Net](http://authenticator.me). It is actually in Beta, but I'm planning on launching it soon. +ymback has created a repo, using this as a library on his [Battle.Net Authenticator Online](https://myauth.us). A Chinese-based website. + # Todo * Sanitize inputs diff --git a/classes/Authenticator.php b/classes/Authenticator.php index 9de5cf3..e57b9da 100644 --- a/classes/Authenticator.php +++ b/classes/Authenticator.php @@ -19,7 +19,7 @@ class Authenticator { /** * @var string format for the Battle.Net servers, %s must be replaced by the region */ - static private $server = 'mobile-service.blizzard.com'; + static private $server = array('eu.battle.net','us.battle.net', 'www.battlenet.com.cn'); /** * @var string URI used for initialization @@ -177,7 +177,7 @@ public function waitingtime() { * @return int elapsed time in milliseconds */ public function elapsedtime() { - return ($this->servertime() % $this->waitingtime()); + return fmod(floatval($this->servertime()),$this->waitingtime()); } /** @@ -292,7 +292,15 @@ private function set_secret($secret) { * @return string The server address */ private function server() { - return sprintf(self::$server, strtolower($this->region())); + switch($this->region()){ + case self::$accepted_region[0]: + return self::$server[0]; + case self::$accepted_region[1]: + return self::$server[1]; + case self::$accepted_region[2]: + return self::$server[2]; + } + throw new DataAuthenticatorException('Invalid region provided : '.$this->region().'.'); } //