diff --git a/WebInterface/game-site/account.php b/WebInterface/game-site/account.php index 8ef3148..3eda1e8 100755 --- a/WebInterface/game-site/account.php +++ b/WebInterface/game-site/account.php @@ -1,4 +1,5 @@ +

-If you have an account on this server (PINTO.HORSEISLE.COM) please login in at upper right.
- Otherwise click for Main Horse Isle 1 Site. +If you have an account on this server () please login in at upper right.
+ Otherwise click for >Main Horse Isle 1 Site.

diff --git a/WebInterface/game-site/web/common.php b/WebInterface/game-site/web/common.php index ab667df..a4ddd71 100644 --- a/WebInterface/game-site/web/common.php +++ b/WebInterface/game-site/web/common.php @@ -13,6 +13,14 @@ function hash_salt(string $input, string $salt) return hash('sha512',$xor_hash,false); } +function base64_url_encode($input) { + return strtr(base64_encode($input), '+/=', '._-'); +} + +function base64_url_decode($input) { + return base64_decode(strtr($input, '._-', '+/=')); +} + function is_logged_in() { if(session_status() !== PHP_SESSION_ACTIVE) @@ -45,7 +53,7 @@ function get_username(string $id) $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); - $usetname = intval($result->fetch_row()[0]); + $usetname = $result->fetch_row()[0]; return $usetname; } diff --git a/WebInterface/game-site/web/crosserver.php b/WebInterface/game-site/web/crosserver.php index 89aee12..e532bf1 100644 --- a/WebInterface/game-site/web/crosserver.php +++ b/WebInterface/game-site/web/crosserver.php @@ -8,7 +8,8 @@ function GenHmacMessage(string $data, string $channel) echo("

Set \$hmac_secret in config.php!

"); exit(); } - return $hmac = hash_hmac('sha256', $data, $hmac_secret.$channel.$_SERVER['REMOTE_ADDR'].date('mhdY')); + $hmac = hash_hmac('sha256', $data, $hmac_secret.$channel.$_SERVER['REMOTE_ADDR'].date('mdYhi')); + return $hmac; } function getNoPlayersOnlineInServer($database) diff --git a/WebInterface/game-site/web/header.php b/WebInterface/game-site/web/header.php index 2b3f36a..9b6aa3b 100644 --- a/WebInterface/game-site/web/header.php +++ b/WebInterface/game-site/web/header.php @@ -110,7 +110,7 @@ color: #440000; if(is_logged_in()) { $username = $_SESSION['USERNAME']; - echo('
'.$_SERVER['HTTP_HOST'].'
Logged in as: '.$username.'





'); + echo('
'.strtoupper($_SERVER['HTTP_HOST']).'
Logged in as: '.$username.'





'); } else { diff --git a/WebInterface/master-site/account.php b/WebInterface/master-site/account.php index 85f180e..978859a 100755 --- a/WebInterface/master-site/account.php +++ b/WebInterface/master-site/account.php @@ -57,7 +57,7 @@ if(isset($_GET['CONNECT'])) if(!endsWith($redirectUrl, '/')) $redirectUrl .= '/'; - $redirectUrl .= 'account.php?SLID='.(string)$playerId.'&C='.base64_encode(hex2bin($hmac)); + $redirectUrl .= 'account.php?SLID='.(string)$playerId.'&C='.base64_url_encode(hex2bin($hmac)); header("Location: ".$redirectUrl); exit(); diff --git a/WebInterface/master-site/common.php b/WebInterface/master-site/common.php index ab667df..a4ddd71 100755 --- a/WebInterface/master-site/common.php +++ b/WebInterface/master-site/common.php @@ -13,6 +13,14 @@ function hash_salt(string $input, string $salt) return hash('sha512',$xor_hash,false); } +function base64_url_encode($input) { + return strtr(base64_encode($input), '+/=', '._-'); +} + +function base64_url_decode($input) { + return base64_decode(strtr($input, '._-', '+/=')); +} + function is_logged_in() { if(session_status() !== PHP_SESSION_ACTIVE) @@ -45,7 +53,7 @@ function get_username(string $id) $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); - $usetname = intval($result->fetch_row()[0]); + $usetname = $result->fetch_row()[0]; return $usetname; } diff --git a/WebInterface/master-site/crosserver.php b/WebInterface/master-site/crosserver.php index 89816d7..e532bf1 100644 --- a/WebInterface/master-site/crosserver.php +++ b/WebInterface/master-site/crosserver.php @@ -2,11 +2,14 @@ function GenHmacMessage(string $data, string $channel) { + include('config.php'); if($hmac_secret === "!!NOTSET!!"){ - die("Please set HMAC_SECRET !"); + echo(""); + echo("

Set \$hmac_secret in config.php!

"); exit(); } - return $hmac = hash_hmac('sha256', $data, $hmac_secret.$channel.$_SERVER['REMOTE_ADDR'].date('mhdY')); + $hmac = hash_hmac('sha256', $data, $hmac_secret.$channel.$_SERVER['REMOTE_ADDR'].date('mdYhi')); + return $hmac; } function getNoPlayersOnlineInServer($database)