2021-06-09 08:29:33 +00:00
|
|
|
<?php
|
|
|
|
//require our bootstrap file for database connection
|
2021-06-09 11:20:49 +00:00
|
|
|
session_start();
|
2021-06-09 08:29:33 +00:00
|
|
|
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 11:20:49 +00:00
|
|
|
if(isset($_SESSION['permission'])){
|
2021-06-09 10:36:09 +00:00
|
|
|
$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 11:20:49 +00:00
|
|
|
if($user->save())
|
|
|
|
echo $user->id;
|
|
|
|
}
|