2022-12-20 21:17:03 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
checkPasswordFormat($_POST['password']);
|
|
|
|
|
|
|
|
checkUsernameFormat($_POST['username']);
|
|
|
|
|
|
|
|
$username = hashUsername($_POST['username']);
|
|
|
|
|
|
|
|
if (usernameExists($username) !== false)
|
2023-01-21 01:27:52 +01:00
|
|
|
output(403, _('This username is already taken.'));
|
2022-12-20 21:17:03 +01:00
|
|
|
|
|
|
|
rateLimit();
|
|
|
|
|
|
|
|
$id = hash('sha256', random_bytes(32));
|
|
|
|
|
|
|
|
insert('users', [
|
|
|
|
'id' => $id,
|
|
|
|
'username' => $username,
|
|
|
|
'password' => hashPassword($_POST['password']),
|
|
|
|
'registration_date' => date('Y-m-d H:i:s'),
|
|
|
|
'bucket_tokens' => 0,
|
|
|
|
'bucket_last_update' => 0,
|
|
|
|
'type' => 'testing',
|
2023-03-09 01:35:30 +01:00
|
|
|
'services' => '',
|
2022-12-20 21:17:03 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
stopSession();
|
|
|
|
startSession();
|
|
|
|
|
|
|
|
$_SESSION['id'] = $id;
|
|
|
|
$_SESSION['type'] = 'testing';
|
|
|
|
|
2023-01-07 23:11:44 +01:00
|
|
|
setupDisplayUsername($_POST['username']);
|
|
|
|
|
2022-12-20 21:17:03 +01:00
|
|
|
redir();
|