'.$error.'

'; } if(!isset($_POST['pass']) || !password_verify($_POST['pass'], $user['password'])){ $msg.='

'._('Wrong password!').'

'; }elseif(!isset($_POST['confirm']) || !isset($_POST['newpass']) || $_POST['newpass']!==$_POST['confirm']){ $msg.='

'._('Wrong password!').'

'; }else{ if($_REQUEST['type']==='acc'){ $hash=password_hash($_POST['newpass'], PASSWORD_DEFAULT); $stmt=$db->prepare('UPDATE users SET password=? WHERE id=?;'); $stmt->execute([$hash, $user['id']]); $msg.='

'._('Successfully changed account password.').'

'; }elseif($_REQUEST['type']==='sys'){ $stmt=$db->prepare('INSERT INTO pass_change (user_id, password) VALUES (?, ?);'); $hash=get_system_hash($_POST['newpass']); $stmt->execute([$user['id'], $hash]); $msg.='

'._('Successfully changed system account password, change will take effect within the next minute.').'

'; }elseif($_REQUEST['type']==='sql'){ $stmt=$db->prepare("SET PASSWORD FOR '$user[mysql_user]'@'%'=PASSWORD(?);"); $stmt->execute([$_POST['newpass']]); $db->exec('FLUSH PRIVILEGES;'); $msg.='

'._('Successfully changed sql password.').'

'; }else{ $msg.='

'._("Couldn't update password: Unknown reset type.").'

'; } } } header('Content-Type: text/html; charset=UTF-8'); print_header(_('Change password')); echo $msg; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'._('Reset type:').'
'._('Account password:').'
'._('New password:').'
'._('Confirm password:').'
'; echo '

'._('Go back to dashboard').'

'; echo '';