33 lines
908 B
PHP
33 lines
908 B
PHP
<?php
|
|
include "../../config.php";
|
|
|
|
if (isset($_POST['username']) and isset($_POST['email']) and isset($_POST['password'])){
|
|
$sql = "INSERT INTO `users`(`username`, `email`, `password`) VALUES (?, ?, ?)";
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt->bindParam(1, $_POST['username']);
|
|
$stmt->bindParam(2, $_POST['email']);
|
|
$saltedHash = password_hash($_POST['password'], PASSWORD_BCRYPT);
|
|
$stmt->bindParam(3, $saltedHash);
|
|
if (!$stmt->execute()){
|
|
var_dump($stmt->errorInfo());
|
|
}else{
|
|
header("Location: ../");
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
|
|
</head>
|
|
<body>
|
|
<form method="post">
|
|
<input type="text" name="username" placeholder="Username" required><br>
|
|
<input type="email" name="email" placeholder="Email" required><br>
|
|
<input type="password" name="password" placeholder="Password" required><br>
|
|
<button onclick="submit">Register</button>
|
|
</form>
|
|
</body>
|
|
</html>
|