" . get_user_class() . " is not greater than target user => {$arr['class']}"; write_log($log); do_log($log, 'alert'); stderr("Error","Sorry, you don't have enough permission to reset this user's password."); } $id = $arr['id']; //$wantpassword=$newpassword; //$secret = mksecret(); //$wantpasshash = md5($secret . $wantpassword . $secret); //sql_query("UPDATE users SET passhash=".sqlesc($wantpasshash).", secret= ".sqlesc($secret)." where id=$id"); $userRep = new \App\Repositories\UserRepository(); try { $userRep->resetPassword($id, $newpassword, $newpasswordagain); } catch (\Exception $e) { stderr('Error', $e->getMessage()); } write_log("Password Reset For $username by {$CURUSER['username']}"); if (mysql_affected_rows() != 1) stderr("Error", "Unable to RESET PASSWORD on this account."); stderr("Success", "The password of account $username is reset , please inform user of this change.",false); } stdhead("Reset User's Lost Password"); ?>