itskp-odense/Backend/controller/createUser.php

17 lines
379 B
PHP
Raw Normal View History

<?php
//require our bootstrap file for database connection
2021-06-09 11:20:49 +00:00
session_start();
require "../../bootstrap.php";
2021-06-09 10:36:09 +00:00
use Backend\Model\User;
2021-06-09 11:20:49 +00:00
if(isset($_SESSION['permission'])){
2021-06-09 10:36:09 +00:00
$user = new User();
$user->name = $_POST['name'];
$hashPass = password_hash($_POST['password'], PASSWORD_DEFAULT);
$user->password = $hashPass;
2021-06-09 11:20:49 +00:00
if($user->save())
echo $user->id;
}