fix: resolve XML path for billing provisioning, set server_expiration_date, 6-char passwords
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/ce009e66-16ae-4ca7-a28c-5dac466cc014 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
438e6c8eb2
commit
7e4c29edc7
4 changed files with 72 additions and 11 deletions
|
|
@ -18,12 +18,21 @@ if (session_status() === PHP_SESSION_NONE) {
|
|||
session_start();
|
||||
}
|
||||
|
||||
function billing_generate_password(int $bytes = 12): string
|
||||
function billing_generate_password(): string
|
||||
{
|
||||
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
$len = strlen($alphabet);
|
||||
$password = '';
|
||||
try {
|
||||
return substr(bin2hex(random_bytes($bytes)), 0, $bytes * 2);
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$password .= $alphabet[random_int(0, $len - 1)];
|
||||
}
|
||||
return $password;
|
||||
} catch (Throwable $e) {
|
||||
return substr(hash('sha256', uniqid('gsp', true) . microtime(true)), 0, $bytes * 2);
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$password .= $alphabet[mt_rand(0, $len - 1)];
|
||||
}
|
||||
return $password;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue