v0.1.5 Add the first support for create user account
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user