no message

This commit is contained in:
SilicaAndPina 2021-06-27 14:20:12 +12:00
parent 4362a8a294
commit afd60531fe
8 changed files with 52 additions and 14 deletions

View file

@ -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();

View file

@ -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;
}

View file

@ -2,11 +2,14 @@
function GenHmacMessage(string $data, string $channel)
{
include('config.php');
if($hmac_secret === "!!NOTSET!!"){
die("Please set HMAC_SECRET !");
echo("<script>alert('Please set HMAC_SECRET !')</script>");
echo("<h1>Set \$hmac_secret in config.php!</h1>");
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)