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";
|
|
|
|
|
2021-06-09 10:36:46 +00:00
|
|
|
use Backend\Model\User;
|
2021-06-09 08:41:21 +00:00
|
|
|
|
2021-06-09 11:20:49 +00:00
|
|
|
if(isset($_SESSION['permission'])){
|
2021-06-09 10:36:46 +00:00
|
|
|
$user = User::query()->find($_POST['id']);
|
2021-06-09 10:47:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2021-06-09 10:36:46 +00:00
|
|
|
if($user->update()){
|
2021-06-09 08:41:21 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|