v0.2.0 - Added CRUD for user
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
<?php
|
||||
//require our bootstrap file for database connection
|
||||
session_start();
|
||||
require "../../bootstrap.php";
|
||||
|
||||
use Backend\Model\User;
|
||||
|
||||
//if(isset($_SESSION['permission'])){
|
||||
if(isset($_SESSION['permission'])){
|
||||
$user = new User();
|
||||
$user->name = $_POST['name'];
|
||||
$hashPass = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
||||
$user->password = $hashPass;
|
||||
|
||||
if(!$user->save()){
|
||||
echo "Error";
|
||||
}else{
|
||||
echo "saved";
|
||||
}
|
||||
//}
|
||||
if($user->save())
|
||||
echo $user->id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user