Example #1
0
 public static function smtp_init()
 {
     self::$smtp_server = mod_config::get_one_config('fl_smtpserver');
     self::$smtp_port = mod_config::get_one_config('fl_smtpport');
     self::$smtp_ssl = mod_config::get_one_config('fl_smtpssl');
     self::$smtp_auth = mod_config::get_one_config('fl_smtpauth');
     self::$smtp_user = mod_config::get_one_config('fl_smtpid');
     self::$smtp_pwd = mod_config::get_one_config('fl_smtppass');
 }
 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');
 }