1
0
Fork 0

Generate a random string as invite code

master
Anonymous Contributor 2023-08-23 18:16:35 +02:00
parent 8c7a31d88a
commit 57ff06d418
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@
$validator = new FormValidator(array()); // Needed only for CSRF token validation $validator = new FormValidator(array()); // Needed only for CSRF token validation
if($validator->isValid($_POST)) { if($validator->isValid($_POST)) {
$inviteID = md5(time().$_SESSION['UUID'].rand(11111, 9999999)); $inviteID = bin2hex(random_bytes(16));
$link = "https://".$_SERVER['SERVER_NAME']."/index.php?page=register&code=".$inviteID; $link = "https://".$_SERVER['SERVER_NAME']."/index.php?page=register&code=".$inviteID;
$statement = $RUNTIME['PDO']->prepare('INSERT INTO `InviteCodes` (`InviteCode`) VALUES (:InviteCode)'); $statement = $RUNTIME['PDO']->prepare('INSERT INTO `InviteCodes` (`InviteCode`) VALUES (:InviteCode)');