Example #1
0
            exit;
        }
        $value = DB::fetch_first("Select * From " . DB::table("users") . " WHERE email='" . $email . "' and uname='" . $username . "'");
        if (!empty($value)) {
            //发送邮件到邮箱
            $string = $value['uname'] . "\t" . $value['activekey'] . "\t" . $value['email'];
            $codestring = cookie_authcode($string, 'ENCODE', "", 3600 * 24);
            //exit;
            $subject = "{$cfg_site_name} 会员 {$value['uname']}重设密码";
            //发送邮件操作
            $site = SITE_URL;
            $codestring = str_replace("+", "%2B", $codestring);
            $emailstr = "hi {$value['uname']},<BR><BR>您在{$cfg_site_name}申请了重设密码,请点击下面的链接,然后根据页面提示完成密码重设:<BR><BR><BR><A href='{$site}/user.php?action=newpass&code={$codestring}' target=_blank>{$site}/user.php?action=newpass&code={$codestring}</A><BR><BR>-- <BR>{$cfg_site_name}";
            include_once INC_PATH . "/sendmail.class.php";
            $sendmail = new SendEmail();
            $sendmail->sendmailto($subject, $emailstr, $value['email']);
            include template('resetp_SendEmail');
            //显示邮件已经发送到邮箱
            exit;
        } else {
            print "<script language='javascript'>alert('用户名和邮箱不区配');history.go(-1);</script>";
            exit;
        }
    } else {
        include template('ForgotPassword');
        //包含输出指定模板
    }
} elseif ($action == 'newpass') {
    //重置密码
    InitGP(array("code", "password", "password2", "commit"));
    //初始化变量全局返回
Example #2
0
include "function_common.php";
InitGP(array("page", "action", "inbox", "uname", "email", "subject", "message", "did", "delids"));
//初始化变量全局返回
AjaxHead();
//禁止页面缓存
header("Content-type: text/html; charset=" . CHARSET);
if (empty($action)) {
    InitGP(array("uid", "isadmin", "email", "subject", "message"));
    //初始化变量全局返回
    if (!empty($_POST) and !empty($subject)) {
        //发送邮件
        if (isemail($email) && !empty($message)) {
            $emailstr = $message;
            include_once INC_PATH . "/sendmail.class.php";
            $sendmail = new SendEmail();
            $sendmail->sendmailto($subject, $emailstr, $email);
            if (!empty($inbox)) {
                exit("<script language='javascript'>alert('" . $sendmail->printmsg . "');parent.\$.fn.colorbox.close();</script>");
            } else {
                showmsg($sendmail->printmsg, PHP_SELF);
                //出错!
            }
        } else {
            if (!empty($inbox)) {
                exit("<script language='javascript'>alert('email格式错误');location.reload();</script>");
            } else {
                showmsg("email格式错误", PHP_SELF);
                //出错!
            }
        }
    } else {
Example #3
0
 function sendactiveemail($uname = "", $email = "")
 {
     global $cfg_site_name;
     $uname = Char_cv($uname);
     //过滤
     if (!empty($email)) {
         $this->email = $email;
     }
     if (!empty($uname)) {
         $row = $this->db->fetch_first("Select activekey,state,email From `{$this->table}` WHERE uname='{$uname}'");
         if (!empty($row['activekey'])) {
             if ($row['state'] == 1) {
                 return 'approved';
                 //已经激活
             }
             $this->email = $row['email'];
             $this->uname = $uname;
             $string = $uname . "\t" . $row['activekey'];
         } else {
             return lang('Specifieduser_notexist');
         }
     } else {
         $string = $this->uname . "\t" . $this->activekey;
     }
     $codestring = cookie_authcode($string, 'ENCODE', "", 3600);
     //exit;
     $subject = lang('account_activation_email', array('$cfg_site_name' => $cfg_site_name, '$this->uname' => $this->uname));
     //发送邮件操作
     $site = str_replace("/ajax", "", SITE_URL);
     $codestring = str_replace("+", "%2B", $codestring);
     $emailstr = "hi {$this->uname},<BR><BR>" . lang('Click_link_activate', array('$cfg_site_name' => $cfg_site_name)) . "<BR><BR><BR><A href='{$site}/user.php?action=active&code={$codestring}' target=_blank>{$site}/user.php?action=active&code={$codestring}</A><BR><BR>-- <BR>{$cfg_site_name}";
     include_once INC_PATH . "/sendmail.class.php";
     $sendmail = new SendEmail();
     $sendmail->sendmailto($subject, $emailstr, $this->email);
     return "OK";
 }