random_bytes() only for >PHP7

This commit is contained in:
paponius 2023-06-28 18:46:27 +02:00
parent f380478197
commit b87a858577

View file

@ -245,7 +245,11 @@ if (defined('FM_EMBED')) {
//Generating CSRF Token
if (empty($_SESSION['token'])) {
$_SESSION['token'] = bin2hex(random_bytes(32));
if (function_exists('random_bytes')) {
$_SESSION['token'] = bin2hex(random_bytes(32));
} else {
$_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32));
}
}
if (empty($auth_users)) {