cleanup stuff
This commit is contained in:
parent
f542656bc9
commit
66300ccd71
4 changed files with 12 additions and 2 deletions
|
@ -44,6 +44,12 @@ function post_handler()
|
|||
$stmt = $db->prepare("INSERT INTO main.auth (username, password) VALUES (?, ?)");
|
||||
$stmt->execute([$user,$hashed]);
|
||||
|
||||
$token = bin2hex(random_bytes(32));
|
||||
$stmt = $db->prepare("INSERT INTO main.token (username, token) VALUES (?, ?)");
|
||||
$stmt->execute([$user,$token]);
|
||||
|
||||
setcookie("token", $token, time() + 3600 * 24);
|
||||
|
||||
header("Location: /");
|
||||
die();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue