itskp-odense/Backend/controller/createUser.php

19 lines
401 B
PHP

<?php
//require our bootstrap file for database connection
require "../../bootstrap.php";
use Backend\Model\Post;
if(isset($_SESSION['permission'])){
$user = new Post();
$user->name = $_POST['name'];
$hashPass = password_hash($_POST['password'], PASSWORD_DEFAULT);
$user->password = $hashPass;
if(!$user->save()){
echo "Error";
}else{
echo "saved";
}
}