The following files exists in this folder. Click to view.
create-user.php
index.php
initialize-db.php
insert.php
insert_page.php
test.php
translate.php
create-user.php
34 lines ASCII Windows (CRLF)
<?php
include "../include.php";
$enableCreation = true; // if true anyone can create a user (just for easy setup since security is not really important)
if ($enableCreation && isset($_POST["password"]) && isset($_POST["email"])) {
$password = $_POST["password"];
$email = $_POST["email"];
$passwordHash = password_hash(($password), PASSWORD_DEFAULT);
quick_statment("INSERT INTO user (email, password_hash) VALUES(?, ?)", "ss", $email, $passwordHash);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include "components/head.php" ?>
</head>
<body>
<?php include "components/header.php"; ?>
<form method="POST">
<p>Email</p>
<input name="email" type="text">
<p>Password</p>
<input name="password" type="text">
<button>Create User</button>
</form>
</body>
</html>