shopping-list/php/adduser_action.php
2018-10-24 15:00:27 +02:00

15 lines
452 B
PHP

<?php
session_start();
include $_SESSION["docroot"].'/php/connect.php';
include $_SESSION["docroot"].'/php/hash.php';
$salt = create_salt();
$password = hash_password($_POST["passwd"], $salt);
$result = $mysqli->query("INSERT INTO `users` (`username`, `password`, `salt`, `last_login`) VALUES ('".$_POST["username"]."', '".$password."', '".$salt."', CURRENT_TIMESTAMP);");
$mysqli->close();
unset($salt);
unset($password);
header("Location: /");
?>