public static function getpwd($username, $email) { $name = trim($username); $mail = trim($email); if (!isemail($email)) { throw new Exception("请输入的邮箱格式不正确."); } $uinfo = pm_db::fetch_result("SELECT * FROM iosadm_admin_user WHERE user_name='{$name}'"); if (!$uinfo) { throw new Exception("该用户不存在."); } if ($uinfo['email'] != $mail) { throw new Exception("邮箱和用户不符合."); } $newpassword = randstr(8); $npwd = md5($newpassword); pm_db::query("UPDATE iosadm_admin_user SET password='******' WHERE user_id='{$uinfo['user_id']}'"); $mailtxt = "您的新密码为:{$newpassword}"; @mod_mail::send($mail, $name, '找回密码', $mailtxt, 'html'); }