itskp-odense/Backend/controller/createUser.php

17 lines
379 B
PHP

<?php
//require our bootstrap file for database connection
session_start();
require "../../bootstrap.php";
use Backend\Model\User;
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 $user->id;
}