v0.1.5 Add the first support for create user account

This commit is contained in:
Victor
2021-06-09 11:13:12 +02:00
parent d0e2900941
commit b0fd4d4320
5 changed files with 17 additions and 13 deletions
+10 -10
View File
@@ -4,15 +4,15 @@ require "../../bootstrap.php";
use Backend\Model\Post;
if(isset($_POST['title'])){
//Create a new initialize
$post = new Post();
if(isset($_SESSION['permission'])){
$user = new Post();
$user->name = $_POST['name'];
$hashPass = password_hash($_POST['password'], PASSWORD_DEFAULT);
$user->password = $hashPass;
//Get the data from post and save it to the post model
$post->title = $_POST['title'];
$post->description = $_POST['description'];
//Call the save function.
if($post->save())
echo $post->id;
if(!$user->save()){
echo "Error";
}else{
echo "saved";
}
}