2021-06-09 08:29:33 +00:00
|
|
|
<?php
|
|
|
|
//require our bootstrap file for database connection
|
|
|
|
require "../../bootstrap.php";
|
|
|
|
|
2021-06-09 10:36:09 +00:00
|
|
|
use Backend\Model\User;
|
2021-06-09 08:29:33 +00:00
|
|
|
|
2021-06-09 10:36:09 +00:00
|
|
|
//if(isset($_SESSION['permission'])){
|
|
|
|
$user = new User();
|
2021-06-09 09:13:12 +00:00
|
|
|
$user->name = $_POST['name'];
|
|
|
|
$hashPass = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
|
|
|
$user->password = $hashPass;
|
2021-06-09 08:29:33 +00:00
|
|
|
|
2021-06-09 09:13:12 +00:00
|
|
|
if(!$user->save()){
|
|
|
|
echo "Error";
|
|
|
|
}else{
|
|
|
|
echo "saved";
|
|
|
|
}
|
2021-06-09 10:36:09 +00:00
|
|
|
//}
|