itskp-odense/Backend/controller/updateUser.php

24 lines
452 B
PHP
Raw Normal View History

2021-06-09 08:41:21 +00:00
<?php
2021-06-09 11:20:49 +00:00
session_start();
2021-06-09 08:41:21 +00:00
require "../../bootstrap.php";
use Backend\Model\User;
2021-06-09 08:41:21 +00:00
2021-06-09 11:20:49 +00:00
if(isset($_SESSION['permission'])){
$user = User::query()->find($_POST['id']);
if(!empty($_POST['upName'])){
$user->name = $_POST['upName'];
}
if(!empty($_POST['upPassword'])){
$newPass = password_hash($_POST['upPassword'], PASSWORD_DEFAULT);
$user->password = $newPass;
}
2021-06-09 08:41:21 +00:00
if($user->update()){
2021-06-09 08:41:21 +00:00
return 1;
}
}