Switch to a more secure method for generation of the CSRF token

This commit is contained in:
Fedor A. Fetisov 2013-09-13 19:53:20 +04:00
parent 2334a0ed0a
commit d7c18215c5

View File

@ -755,7 +755,7 @@ function print_csrf_token_in_url()
function setcsrftoken()
{
if (!isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = sha1(rand(10000000, 99999999));
$_SESSION['csrf_token'] = sha1(session_id() . (function_exists('openssl_random_pseudo_bytes') ? openssl_random_pseudo_bytes(32) : (time() + microtime()) . mt_rand(0, 99999999)));
}
}