We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 41c6dfc + cb7168f commit 0cbb361Copy full SHA for 0cbb361
web/inc/main.php
@@ -59,10 +59,10 @@
59
exit;
60
}
61
62
+// Generate CSRF token
63
if (isset($_SESSION['user'])) {
64
if(!isset($_SESSION['token'])){
- $token = uniqid(mt_rand(), true);
65
- $_SESSION['token'] = $token;
+ $_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(16));
66
67
68
web/login/index.php
@@ -126,7 +126,7 @@
126
127
128
// Generate CSRF token
129
-$_SESSION['token'] = md5(uniqid(mt_rand(), true));
+$_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(16)); // generate 32-character cryptographically secure token
130
131
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$_SESSION['language'].'.php');
132
require_once('../templates/header.html');
0 commit comments