コード例 #1
0
ファイル: getpass.php プロジェクト: noikiy/meilala
 public function verify()
 {
     if (!IsGet('key') or !IsGet('sid')) {
         $this->out('邮件验证参数非法!');
     }
     $key = ForceStringFrom('key');
     $sid = ForceStringFrom('sid');
     if (!$key or !$sid) {
         $this->out('邮件验证参数非法!');
     }
     $email = base64_decode($key);
     if (!IsEmail($email)) {
         $this->out('Email地址非法!');
     }
     if (!($user = APP::$DB->getOne("SELECT u.aid, u.username, u.password, u.fullname, u.verifycode FROM " . TABLE_PREFIX . "admin u WHERE u.email = '{$email}' AND u.activated = 1"))) {
         $this->out('Email地址不存在!');
     } else {
         $code = md5($user['fullname'] . WEBSITE_KEY . $user['password'] . $user['verifycode']);
         if ($sid != $code) {
             $this->out('链接请求的验证码错误!');
         }
         $newpass = PassGen(8);
         $backend_url = BASEURL . ADMINDIR . '/';
         $subject = '您的新密码 -- ' . APP::$_CFG['Title'];
         $content = "{$user['fullname']}:<br><br>您好! <br><br>您的登录名是: {$user['username']}<br>您的新密码是:{$newpass}<br><br>";
         $content .= "请点击以下链接登录后台管理:<br><br><a href=\"{$backend_url}\" target=\"_blank\">{$backend_url}</a><br><br>";
         if (SendMail($email, $subject, $content) === true) {
             //邮件发送成功后才更新用户密码, 清空验证码防止重复点击邮件中更新密码的链接
             APP::$DB->exe("UPDATE " . TABLE_PREFIX . "admin SET password    = '******', verifycode = '' WHERE aid = '{$user['aid']}'");
             $this->out('新密码已发送到您的邮箱, 请查收!', 0);
         } else {
             $this->out('发送邮件失败! 请尝试刷新当前页面.');
         }
     }
 }
コード例 #2
0
 public function promotion_pay_success_api()
 {
     M('promotion')->where(array('submission_id' => I('submission_id'), 'promotion_code' => I('promotion_code')))->save(array('ispaied' => 1));
     $email = M('email')->where(array('name' => '购买推广'))->find();
     $email_content = $email['content'];
     if (count(explode("\n", $email_content)) == 1) {
         $email_content = explode("\r", $email_content);
     } else {
         $email_content = explode("\n", $email_content);
     }
     $temp = '';
     foreach ($email_content as $key => $value) {
         $temp .= $value . "<br/>";
     }
     $email_content = $temp;
     $submission = M('submission')->where(array('id' => I('submission_id')))->find();
     $tmp = '作品中文名称:' . $submission['titlec'] . '<br/>作品英文名称:' . $submission['titlee'] . '<br/>作品类别:' . $submission['category'];
     $email_content = explode("^^^", $email_content);
     $email_content = $email_content[0] . $tmp . $email_content[1];
     $admins = M('user')->where(array('role' => 2))->select();
     foreach ($admins as $key => $value) {
         SendMail($value['email'], $email['title'], $email_content);
     }
     echo json_encode(array('submission_id' => I('submission_id'), 'promotion_code' => I('promotion_code')));
 }
コード例 #3
0
 function insert()
 {
     if (empty($_REQUEST['title'])) {
         $this->error('项目名称不能为空!');
     }
     $name = $this->getActionName();
     $model = D($name);
     if (false === $model->create()) {
         $this->error($model->getError());
     }
     //保存当前数据对象
     $list = $model->add();
     if ($list !== false) {
         //保存成功
         $proUser = M("ProjectsUser");
         $proUser->user_id = $_REQUEST['creator'];
         $proUser->project_id = $list;
         $proUser->add();
         if (!empty($_REQUEST['invite'])) {
             import('@.ORG.Util.Mail');
             $mailContent = '<p>Hi! ' . $_SESSION['userName'] . ' 邀请你一起参与' . $_REQUEST['title'] . '项目。</p><p>点击下面的链接,即可参与:</p><div> <a href="' . C('domain') . U('Public/join', array('id' => $list)) . '" target="_blank"> ' . C('domain') . U('Public/join', array('id' => $list)) . ' </a><div></div></div><p>如有问题,可与 ' . $_SESSION['userName'] . ' 联系: <a href="mailto:' . $_SESSION['email'] . '" target="_blank">' . $_SESSION['email'] . '</a></p>';
             $mailArr = explode(',', $_REQUEST['invite']);
             foreach ($mailArr as $k => $v) {
                 SendMail($v, $_REQUEST['title'] . ' 项目成员邀请函', $mailContent, 'IT项目实验室(QQ群:273950048)');
             }
         }
         $this->success('创建成功!', cookie('_currentUrl_'));
     } else {
         //失败提示
         $this->error('创建失败!');
     }
 }
コード例 #4
0
 public function send_email_ajax_res()
 {
     //import('.ORG.Mail');//引入发送邮件类
     //由于这里的文件加载使用import出现错误,所以在这里应用的require的加载方式
     require_once './Component/Mail.class.php';
     //SendMail('目标地址','邮件标题','正文','发件人');//发送邮件类具体参数
     $target_address = $_POST['target_address'];
     $email_title = $_POST['email_title'];
     $email_content = $_POST['email_content'];
     // 		$send_person="*****@*****.**";//这是我的测试网站的名称
     $send_person = "爱做梦-数据监控平台-徐宁";
     if (empty($target_address) && empty($email_title) && empty($email_content)) {
         echo "邮件不完整!";
     } else {
         $email_reslt = SendMail($target_address, $email_title, $email_content, $send_person);
         if ($email_reslt == 1) {
             $email_bd_obg = D('Emails');
             $email_bd_obg->geter = $target_address;
             $email_bd_obg->title = $email_title;
             $email_bd_obg->content = $email_content;
             $email_bd_obg->sendtime = date("y-m-d", time());
             $add_email_res = $email_bd_obg->add();
             //这里添加完成之后就不在给予任何的提示
             echo "发送成功!";
         } else {
             echo "发送失败!";
         }
     }
 }
コード例 #5
0
    /**
     * 发送验证邮件
     * @param string $to 收信人
     */
    public function sendEmailHandler()
    {
        //后台再来一遍验证呀
        if (!preg_match("/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+\$/", $this->_post('email'))) {
            $this->ajaxReturn(3, "邮箱格式不正确", 1);
            return;
        }
        $email = $this->_post('email');
        //验证邮箱唯一性
        $f = $this->checkEmailUnique();
        if (!$f) {
            return;
        }
        $vld_url = $this->buildUrl($email);
        $title = "小蜜蜂兼职";
        $message = <<<EOT
\t\t您的邮箱为:{$email},

\t\t您的验证码为:{$vld_url}
EOT;
        if (SendMail($email, $title, $message)) {
            //设置session
            session('email_ver', $verify);
            session('email', $email);
            $this->ajaxReturn(1, "发送成功", 1);
        } else {
            $this->ajaxReturn(0, "发送失败", 1);
        }
    }
コード例 #6
0
 public function runemail()
 {
     $emailsys = M('sys')->where(array('sys_id' => 1))->find();
     $config = array('MAIL_FROM' => $emailsys['email_name'], 'MAIL_HOST' => $emailsys['email_smtpname'], 'MAIL_USERNAME' => $emailsys['email_emname'], 'MAIL_FROMNAME' => $emailsys['email_rename'], 'MAIL_PASSWORD' => $emailsys['email_pwd']);
     if ($emailsys['email_open'] == 1) {
         //邮件发送开关
         $config['MAIL_SMTPAUTH'] = TRUE;
     } else {
         $config['MAIL_SMTPAUTH'] = FALSE;
     }
     C($config);
     $admin = M('admin')->where(array('admin_email' => I('email')))->find();
     if (!$admin) {
         $this->error('邮件不存在,请重新输入', 0, 0);
     }
     $oldnum = rand(10000, 99999);
     //获取一串随机数
     $num = md5($oldnum);
     //对随机数进行加密后传递
     $emailpwd = M('admin')->where(array('admin_email' => I('email')))->setField('admin_mdemail', $num);
     //更新数据库
     $content = "尊敬的用户,您好:<br>您当前的操作为找回密码,请点击以下链接重新设置密码<br><a href=http://127.0.0.1/newadmin/index.php/Admin/Login/checkpwd/emailpwd/{$num}.html>http://127.0.0.1/newadmin/index.php/Admin/Login/checkpwd/emailpwd/{$num}.html</a>";
     if (SendMail($_POST['email'], '找回密码服务', $content)) {
         $this->success('邮件发送成功!,打开邮件重新设置密码', 1, 1);
     } else {
         $this->error('邮件发送失败', 0, 0);
     }
 }
コード例 #7
0
ファイル: report.php プロジェクト: Cyberspace-Networks/TGPX
function txReportAdd()
{
    global $DB, $C, $L, $t, $domain;
    $gallery = $DB->Row('SELECT * FROM `tx_galleries` WHERE `gallery_id`=?', array($_REQUEST['id']));
    $v = new Validator();
    $v->Register($_REQUEST['reason'], V_EMPTY, sprintf($L['REQUIRED_FIELD'], $L['REPORT']));
    if (!$gallery) {
        $v->SetError($L['BAD_GALLERY_ID']);
    }
    if ($C['report_captcha']) {
        VerifyCaptcha($v);
    }
    if (!$v->Validate()) {
        return $v->ValidationError('txShReportAdd', TRUE);
    }
    $DB->Update('INSERT INTO `tx_reports` VALUES (?,?,?,?,?)', array(null, $gallery['gallery_id'], $_SERVER['REMOTE_ADDR'], MYSQL_NOW, $_REQUEST['reason']));
    $_REQUEST['report_id'] = $DB->InsertID();
    $t->assign_by_ref('report', $_REQUEST);
    $t->display($domain['template_prefix'] . 'report-complete.tpl');
    flush();
    // See if we need to e-mail any administrators
    $reports_waiting = $DB->Count('SELECT COUNT(*) FROM `tx_reports`');
    $t->assign('reports_waiting', $reports_waiting);
    $administrators =& $DB->FetchAll('SELECT * FROM `tx_administrators`');
    foreach ($administrators as $administrator) {
        if ($administrator['reports_waiting'] > 0) {
            if ($administrator['notifications'] & E_CHEAT_REPORT && $reports_waiting % $administrator['reports_waiting'] == 0) {
                SendMail($administrator['email'], 'email-admin-reports.tpl', $t);
            }
        }
    }
}
コード例 #8
0
 public function j_email()
 {
     // 如果
     if (isset($_POST['em'])) {
         $email = $_POST['em'];
         $account_model = D('Account');
         // 证明已经注册过
         if ($account_model->judge_account_id_isset($email)) {
             Response::show('-101', '该邮箱已经被注册!');
         } else {
             // 发送给用户的信息
             $rand_string = strtolower(rand_string());
             $title = '欢迎您注册!么么哒。';
             $content = '您好,您的注册验证码是 : ' . $rand_string . '   !, 如果不是本人操作,请忽略!';
             $Memcached = Memcached::getInstance();
             // 暂时不加密了。
             $Memcached->set($email, $rand_string);
             if (SendMail($email, $title, $content) === true) {
                 Response::show('200', '已经发送验证码,请注意查收!');
             } else {
                 Log::write('发送验证码失败,to [--' . $email . '--]', 'WARN');
                 Response::show('-102', '邮件发送失败,未知原因!');
             }
         }
     }
     Response::show('-103', '数据丢失!');
 }
コード例 #9
0
 public function Test_email()
 {
     echo "<h1>测试发送邮件</h1>";
     import('.ORG.Mail');
     //引入发
     // 		SendMail('目标地址','邮件标题','正文','发件人');
     $target_address = $_POST['target_address'];
     $email_title = $_POST['email_title'];
     $email_content = $_POST['email_content'];
     $send_person = "*****@*****.**";
     if (empty($target_address) && empty($email_title) && empty($email_content)) {
         $this->display();
     } else {
         $email_reslt = SendMail($target_address, $email_title, $email_content, $send_person);
         if ($email_reslt == 1) {
             /**
             * 测试保留
             * 	echo "<br/>".$target_address;
             					echo "<br/>".$email_title;
             					echo "<br/>".$email_content;
             					echo "<br/>".$send_person;
             */
             $this->redirect("email_successful");
         } else {
             $this->redirect("email_error");
         }
     }
 }
コード例 #10
0
 public function add()
 {
     if (SendMail($_POST['mail'], $_POST['title'], $_POST['content'])) {
         $this->success('发送成功!');
     }
     //else
     //$this->error('发送失败');
 }
コード例 #11
0
ファイル: notification.php プロジェクト: thezawad/Sicily
function SendMailByNetid($netid, $subject, $msg)
{
    $netid_suffix = array("@mail2.sysu.edu.cn", "@mail.sysu.edu.cn", "@student.sysu.edu.cn");
    foreach ($netid_suffix as $suffix) {
        SendMail($netid . $suffix, $subject, $msg);
    }
    return 0;
}
コード例 #12
0
 public function register($username = "", $password = "", $repassword = "", $email = "", $verify = "")
 {
     if (!C("USER_ALLOW_REGISTER")) {
         $this->error("注册已关闭");
     }
     if (IS_POST) {
         //注册用户
         /* 检测验证码 */
         //if(!check_verify($verify)){
         //$this->error("验证码输入错误!");
         //}
         /* 检测密码 */
         if ($password != $repassword) {
             $this->error("密码和重复密码不一致!");
         }
         /* 调用注册接口注册用户 */
         $User = new UserApi();
         //返回ucentermember数据表用户主键id
         $uid = $User->register($username, $password, $email);
         if (0 < $uid) {
             //注册成功
             //TODO: 发送验证邮件
             // 配置邮件提醒
             $mail = $_POST['email'];
             //获取会员邮箱
             $title = "注册提醒";
             $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>注册了账号,请点击激活' . $mail;
             if (C('MAIL_PASSWORD')) {
                 SendMail($mail, $title, $content);
             }
             // 调用登陆
             $this->login($username, $password);
         } else {
             //注册失败,显示错误信息
             $this->error($this->showRegError($uid));
         }
     } else {
         $menu = R("index/menulist");
         /* 购物车调用*/
         $cart = R("shopcart/usercart");
         $this->assign("usercart", $cart);
         if (!session("user_auth")) {
             $usercart = $_SESSION["cart"];
             $this->assign("usercart", $usercart);
         }
         /* 热词调用*/
         $hotsearch = R("Index/getHotsearch");
         $this->assign("hotsearch", $hotsearch);
         $this->assign("categoryq", $menu);
         //显示注册表单
         $this->display();
     }
 }
コード例 #13
0
 public function register($username = "", $password = "", $repassword = "", $email = "", $verify = "")
 {
     $username = safe_replace($username);
     //过滤
     if (!C("USER_ALLOW_REGISTER")) {
         $this->error("注册已关闭");
     }
     if (IS_POST) {
         //注册用户
         /* 检测验证码 */
         //if(!check_verify($verify)){
         //$this->error("验证码输入错误!");
         //}
         /* 检测密码 */
         if ($password != $repassword) {
             $this->error("密码和重复密码不一致!");
         }
         /* 调用注册接口注册用户 */
         $User = new UserApi();
         //返回ucentermember数据表用户主键id
         $uid = $User->register($username, $password, $email);
         if (0 < $uid) {
             //注册成功
             //TODO: 发送验证邮件
             // 配置邮件提醒
             $mail = I('post.email');
             // 过滤$_POST['email'];//获取会员邮箱
             $title = "注册提醒";
             $auth = sha1(C('DATA_AUTH_KEY'));
             $url = $_SERVER['SERVER_NAME'] . U("account/confirm_email", array('regid' => $uid, 'type' => "email", 'auth' => $auth, 'url' => $_SERVER['SERVER_NAME']));
             $words = sha1($url);
             $content = "您在" . C('SITENAME') . "注册了账号,<a href=\"" . $url . "\" target='_blank'>" . $words . '</a>请点击激活' . $mail;
             //记录日志
             addUserLog('新会员注册', $uid);
             if (C('MAIL_PASSWORD')) {
                 SendMail($mail, $title, $content);
             }
             // 调用登陆
             $this->login($username, $password);
         } else {
             //注册失败,显示错误信息
             $this->error($this->showRegError($uid));
         }
     } else {
         $this->meta_title = '会员注册';
         $this->display();
     }
 }
コード例 #14
0
ファイル: cron.php プロジェクト: hackingman/ToplistX
function BulkMail()
{
    global $C, $DB;
    $message = GetValue('bulk_email');
    $t = new Template();
    $t->assign_by_ref('config', $C);
    $result = $DB->Query('SELECT * FROM `tlx_accounts` JOIN `tlx_account_fields` USING (`username`)');
    while ($account = $DB->NextRow($result)) {
        if ($account['status'] == STATUS_ACTIVE) {
            $t->assign_by_ref('account', $account);
            SendMail($account['email'], $message, $t, FALSE);
        }
    }
    $DB->Free($result);
    DeleteValue('bulk_email');
}
コード例 #15
0
ファイル: login_request.php プロジェクト: lionker/cpp_learn
function Entry()
{
    $inputMail = CgiInput("mail", "");
    $inputReturnPage = CgiInput("return_page", "");
    if ($inputMail == "") {
        CgiOutput(__LINE__, "mail cannot be empty");
    }
    if (LoginGetUser() != "") {
        CgiOutput(__LINE__, "already login");
    }
    $validateKey = LoginGetValidateKey($inputMail);
    if (SendMail($inputMail, $validateKey, $inputReturnPage)) {
        CgiOutput(__LINE__, "send mail failed");
    }
    CgiOutput(0, "");
}
コード例 #16
0
 public function reg()
 {
     //接受用户提交的注册信息
     $_POST['username'];
     $password = $_POST['password'];
     $_POST['password'] = md5($_POST['password']);
     $_POST['repasswd'] = md5($_POST['repasswd']);
     $_POST['auth'] = 0;
     $_POST['regtime'] = time();
     $mail_from = $_POST['email'];
     if ($_POST['password'] !== $_POST['repasswd']) {
         exit('两次密码输入不一致!');
     }
     $user = M('user');
     $sql = $user->where("username='******'username']}'")->select();
     //判断帐号是否重复
     if ($sql) {
         $this->error('帐号已经存在,不能重复注册');
     }
     //用户登录成功发送邮件
     import('ORG.Mail');
     // 参数说明(发送到, 邮件主题, 邮件内容, 用户名)
     $mail_name = '童梦网';
     $mail_title = "欢迎注册童梦网";
     $mail_contents = "尊敬的用户:{$_POST['username']},您的密码为 {$password},请牢记您的密码,童梦网,用心服务,感谢您的加入!";
     SendMail($mail_from, $mail_title, $mail_contents, $mail_name);
     //插入注册信息
     if ($user->create()) {
         if ($lastId = $user->add()) {
             $_POST['id'] = $lastId;
             $user_Detail = M('userdetail');
             $RES['uid'] = $lastId;
             $RES['name'] = $_POST['username'];
             $RES['email'] = $_POST['email'];
             $RES['tel'] = $_POST['tel'];
             if ($user_Detail->create()) {
                 if ($user_Detail->add($RES)) {
                     $this->success('注册成功', __APP__ . '/Login');
                 } else {
                     $this->error('注册失败');
                 }
             }
         } else {
             $this->error('注册失败');
         }
     }
 }
コード例 #17
0
ファイル: HelpAction.class.php プロジェクト: omusico/AndyCMS
 /**
  * 发送完成
  */
 function send_email()
 {
     $email_to = trim($_POST['email_to']);
     $title = trim($_POST['title']);
     $message = trim($_POST['description']);
     if (empty($title) || empty($message)) {
         $this->error("发送失败,请填写完全内容!");
     } else {
         if (SendMail($email_to, $title, $message) !== false) {
             //发送警告成功,则将用户的警告数加1
             $this->assign("jumpUrl", __APP__ . "/Block/index");
             $this->success("发送成功!");
         } else {
             $this->error("发送失败,请联系管理员!!!");
         }
     }
 }
コード例 #18
0
	public function mail()
	{
		if(IS_POST)
		{
			$title=I("title","UnkownTitle","strip_tags");
			$content=I("content","Nocontent","strip_tags");
			$reveiver=I("receiver","*****@*****.**","strip_tags");
			
			SendMail($reveiver,$title,$content);
			$this->success("发送成功","/index.php/Index/mail");
			
		}
		else
		{
			$this->display();
		}
	}
コード例 #19
0
 public function register($password = "", $repassword = "", $email = "", $verify = "")
 {
     /* 检测验证码 */
     if (!check_verify($verify)) {
         $this->ajaxError('验证码输入错误!');
     }
     if (empty($password) || empty($repassword) || empty($email)) {
         $this->ajaxError('对不起,不能为空');
     }
     /* 检测密码 */
     if ($password != $repassword) {
         $this->ajaxError('密码和重复密码不一致!');
     }
     /* 调用注册接口注册用户 */
     $User = new UserApi();
     //返回ucentermember数据表用户主键id
     $uid = $User->register($password, $email);
     if (0 < $uid) {
         //注册成功
         //TODO: 发送验证邮件
         $mail = $_POST['email'];
         //获取会员邮箱
         $title = "欢迎注册" . C('SITENAME');
         $token = sha1(C('DATA_AUTH_KEY') . $mail);
         //U("account/confirm_email",array('token'=>$token)  'wine/active/:token\w'
         $url = $_SERVER['SERVER_NAME'] . U("wine/active/" . $token);
         $this->assign('url', $url);
         $this->assign('mail', $mail);
         $this->assign('time', date('Y-m-d H:i:s', time()));
         $content = $this->fetch('User:register');
         //            $content   ="您在".C('SITENAME')."注册了账号,<a href=\"".$url."\" target='_blank'>".$url.'</a>请点击激活'.$mail;
         $res = SendMail($mail, $title, $content);
         if ($res) {
             S($token, array('email' => $mail, 'uid' => $uid), 3600 * 24 * 3);
             //有效期3天
             $this->ajaxSuccess("<h4>恭喜您,注册成功!</h4>请尽快到您的邮件中进行激活");
         } else {
             $User->deleteUserById($uid);
             $this->ajaxError('注册失败,邮件没有成功发送!');
         }
     } else {
         //注册失败,显示错误信息
         $this->ajaxError($this->showRegError($uid));
     }
 }
コード例 #20
0
ファイル: PublicAction.class.php プロジェクト: hejainwei/idp
 public function create()
 {
     $User = D("User");
     if (!$User->create()) {
         $this->error($User->getError());
     } else {
         // 写入帐号数据
         if ($result = $User->add()) {
             $this->addRole($result);
             /*$Teams=M("Teams");
               $Teams->title=$_REQUEST['title'];
               $Teams->creator=$_REQUEST['account'];
               $Teams->create_time=time();
               $rs=$Teams->add();
               $this->addTeamsUserMap($rs,$result);*/
             import('@.ORG.Util.Mail');
             $mailContent = '<p>Hi, ' . $_REQUEST['account'] . ':</p><p>欢迎使用项目协作平台, 点击下面的链接激活账号,以便获得更好的服务体验:</p><div><a href="' . C('domain') . U('Public/active', array('id' => $result)) . '" target="_blank">' . C('domain') . U('Public/active', array('id' => $result)) . '</a><div></div></div><p>如果你不清楚上述所说,请忽略此邮件哈。</p>';
             SendMail($_REQUEST['email'], '感谢您注册使用项目协作平台', $mailContent, 'IT项目实验室(QQ群:273950048)');
             $_SESSION[C('USER_AUTH_KEY')] = $result;
             $_SESSION['email'] = $_REQUEST['email'];
             $_SESSION['userName'] = $_REQUEST['account'];
             //$_SESSION['lastLoginTime']		=	time();
             //$_SESSION['login_count']	=	$authInfo['login_count'];
             /*if($authInfo['account']=='admin') {
                   $_SESSION['administrator']		=	true;
               }*/
             //保存登录信息
             $User = M('User');
             $ip = get_client_ip();
             $time = time();
             $data = array();
             $data['id'] = $result;
             $data['last_login_time'] = $time;
             $data['login_count'] = array('exp', 'login_count+1');
             $data['last_login_ip'] = $ip;
             $User->save($data);
             // 缓存访问权限
             import('@.ORG.Util.RBAC');
             RBAC::saveAccessList();
             $this->success('创建成功!', U('Projects/index'));
         } else {
             $this->error('创建失败!');
         }
     }
 }
コード例 #21
0
 public function index()
 {
     if (time() - $_SESSION[C('USER_AUTH_EMAIL_time')] < 60) {
         $this->error(L('对不起!你发验证邮件速度太快了,请等待60秒钟后再发!'));
     }
     $email = $_POST['email'];
     $uid = $_POST['uid'];
     $uname = $_POST['uname'];
     $regtime = strtotime($_POST['regtime']);
     $etoken = md5($regtime . $uid);
     //验证加密
     $title = "工大跳蚤街会员邮箱激活";
     $neirong = "<html>亲爱的" . $uname . "<br>请点击下面的链接激活邮箱:<a href='http://www.hititp.com/index.php/index/activeemail/check/uid/" . $uid . "/token/" . $etoken . "'>http://www.hititp.com/index.php/index/activeemail/check/uid/" . $uid . "/token/" . $etoken . "</a></br>-----------------------------------------------<br>如果您点击上述链接无效,请把上面的地址拷贝到浏览器的地址栏中。<br><br>该邮件来自:<a href=http://www.hititp.com>www.hititp.com&nbsp&nbsp工大跳蚤街</a></html>";
     SendMail($email, $title, $neirong);
     $_SESSION[C('USER_AUTH_EMAIL_time')] = time();
     $this->assign('email', $email);
     $this->display('index');
 }
コード例 #22
0
 public function login()
 {
     if (!IS_POST) {
         $this->error("非法请求");
     }
     $member = M('member');
     $username = I('username');
     $password = I('password', '', 'md5');
     $code = I('verify', '', 'strtolower');
     //验证验证码是否正确
     if (!$this->check_verify($code)) {
         $this->error('验证码错误');
     }
     //验证账号密码是否正确
     $user = $member->where(array('username' => $username, 'password' => $password))->find();
     if (!$user) {
         $this->error('账号或密码错误 :(');
     }
     //验证账户是否被禁用
     if ($user['status'] == 0) {
         $this->error('账号被禁用,请联系超级管理员 :(');
     }
     if ($user['type'] == 1) {
         $this->error('您没权限登陆后台 :(');
     }
     //验证是否为管理员
     //更新登陆信息
     $data = array('id' => $user['id'], 'update_at' => time(), 'login_ip' => get_client_ip());
     //如果数据更新成功  跳转到后台主页
     if ($member->save($data)) {
         session('adminId', $user['id']);
         session('username', $user['username']);
         //发送验证码邮件
         import('ORG.Net.Mail');
         $ip = get_client_ip();
         $time = date("Y-m-d h:i:sa");
         $con = '您好,您的后台管理账户 ' . $username . ' 于 ' . $time . ' 被登录,登录IP地址为 ' . $ip . ' 如果该操作非您本人操作,可能帐号信息已经被泄露,请您及时修改密码。 ';
         SendMail('*****@*****.**', '应急响应中心后台登录提示', $con, '应急响应中心');
         //使用时注意将1009465756@qq.com修改为您的邮箱帐号
         $this->success("登陆成功", U('Index/index'));
     }
     //定向之后台主页
 }
コード例 #23
0
 /**
  * 订单支付成功
  * @param type $money
  * @param type $param
  */
 public function success($money, $param)
 {
     if (session("pay_verify") == true) {
         session("pay_verify", null);
         //处理订单
         $data = array('status' => '1', 'ispay' => '2');
         //订单已经支付,状态为已提交
         M('order')->where(array('tag' => $param['order_id']))->setField($data);
         // 发送邮件
         $uid = M("pay")->where(array('out_trade_no' => $param['order_id']))->getField('uid');
         $mail = get_email($uid);
         //获取会员邮箱
         $title = "支付提醒";
         $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>支付了订单,交易号' . $param['order_id'];
         if (C('MAIL_PASSWORD')) {
             SendMail($mail, $title, $content);
         }
     } else {
         E("Access Denied");
     }
 }
コード例 #24
0
 public function find()
 {
     if (!IS_POST) {
         $this->error("非法请求");
     }
     $member = M('member');
     $email = I('post.email', '', 'email');
     $username = I('post.username');
     //$code = I('verify','','strtolower');
     //验证验证码是否正确
     //if(!($this->check_verify($code))){
     //$this->error('验证码错误');
     //}
     //验证输入邮箱是否存在
     $user = $member->where(array('username' => $username, 'email' => $email))->find();
     if (!$user) {
         $this->error('邮箱不存在 :(');
     }
     //验证账户是否被禁用
     if ($user['status'] == 0) {
         $this->error('账号被禁用,无法找回密码 :(');
     }
     if ($user['type'] == 2) {
         $this->error('前台无法重置管理员密码 :(');
     }
     //发送验证码邮件
     import('ORG.Net.Mail');
     $str = '1234567890abcdefghijklmnopqrstuvwxyz';
     $passwd = $str[rand(0, 35)] . $str[rand(0, 35)] . $str[rand(0, 35)] . $str[rand(0, 35)] . $str[rand(0, 35)] . $str[rand(0, 35)];
     $content = md5($passwd);
     $member = M('member');
     $member->password = $content;
     $member->where(array('username' => $username, 'email' => $email))->save();
     $con = '您好您正在找回密码,您的临时新密码为' . $passwd . '请您妥善保管,登陆平台后请及时修改密码';
     if (SendMail($email, '找回密码', $con, '应急响应中心')) {
         $this->success("发送成功", U('login/index'));
     } else {
         $this->error('账号被禁用 :(');
     }
 }
コード例 #25
0
 public function contest_pay_yes()
 {
     M('submission')->where(array('id' => I('id')))->save(array('ispaied' => 1, 'pay_confirm' => 0));
     $email = M('email')->where(array('name' => '确认支付'))->find();
     $email_content = $email['content'];
     if (count(explode("\n", $email_content)) == 1) {
         $email_content = explode("\r", $email_content);
     } else {
         $email_content = explode("\n", $email_content);
     }
     $temp = '';
     foreach ($email_content as $key => $value) {
         $temp .= $value . "<br/>";
     }
     $email_content = $temp;
     $email_content = explode("^^^", $email_content);
     $email_content = $email_content[0] . U('Contest/info', array('id' => I('id')), false, true) . $email_content[1];
     $user_email = M('user')->where(array('id' => I('user_id')))->find();
     $user_email = $user_email['email'];
     SendMail($user_email, $email['title'], $email_content);
     $this->redirect('Admin/contest_pay_confirm');
 }
コード例 #26
0
    public function email_register()
    {
        $d = $this->do_code();
        if ($d) {
            $user = D("Member");
            $member = M("Memberdetail");
            $res = $user->create();
            if ($res) {
                $user->member_pass = md5($_POST['member_pass']);
                $code = md5(rand());
                $user->code = $code;
                $i = $user->add();
                $m['member_id'] = $i;
                $m['member_nickname'] = I("member_name");
                $member->data($m)->add();
                $message = <<<EOT
<html>
<head><meta charset="utf-8"></head>
<body>
<h3>你好!{$m['member_nickname']}</h3>
<h1><b>欢迎注册时光网</b></h1>
<h3>请点击如下地址激活帐号</h3>
<p>http://172.31.1.43/mtime/index.php/User/register_active/mid/{$i}/code/{$code}</p>
</body>
</html>
EOT;
                if (SendMail($_POST['member_name'], "时光网会员激活", $message)) {
                    $this->success("恭喜你,注册成功,请登录邮箱激活!", U("User/register"));
                } else {
                    $this->error("对不起,注册失败,您的邮箱有问题!", U("User/register"));
                }
            } else {
                $this->error("对不起,注册失败!", U("User/register"));
            }
        } else {
            $this->error("注册失败,验证码错误", U("User/register"));
        }
    }
コード例 #27
0
    /**
     * Main
     * 
     * 发送邮件
     */
    public function sendEmailHandler()
    {
        //判断验证码
        $verify = strtoupper($this->_post('verify'));
        if (session('verify') != md5($verify)) {
            $this->ajaxReturn(2, "验证码错误", 1);
            return;
        }
        //后台再来一遍验证呀
        if (!preg_match("/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+\$/", $this->_post('email'))) {
            $this->ajaxReturn(3, "邮箱格式不正确", 1);
            return;
        }
        $email = $this->_post('email');
        $type = $this->_post('u_type');
        //验证邮箱是否存在
        if (!$this->checkEmail($email, $type)) {
            $this->ajaxReturn(4, '邮箱不存在', 1);
            return;
        }
        $vld_url = $this->buildUrl($email, $type);
        $title = "小蜜蜂兼职";
        $message = <<<EOT
\t\t点击此链接,填写新密码

\t\t{$vld_url}
\t\tby小蜜蜂兼职
EOT;
        if (SendMail($email, $title, $message)) {
            //设置session
            session('email_ver', $verify);
            session('email', $email);
            $this->ajaxReturn(1, "发送成功", 1);
        } else {
            $this->ajaxReturn(0, "发送失败", 1);
        }
    }
コード例 #28
0
 /**
  * 密码找回 
  */
 public function public_forget_password()
 {
     if (IS_POST) {
         $email = $this->_post("email");
         $code = $this->_post("code");
         //验证码开始验证
         if (!$this->verify($code)) {
             $this->error("验证码错误,请重新输入!");
         }
         $Member = M("Member");
         $info = $Member->where(array("email" => $email))->find();
         if ($info) {
             //发送邮件
             $code = urlencode(authcode($info['username'], '', '', 3600));
             $url = CONFIG_SITEURL . "index.php?g=member&c=index&a=public_forget_password&code={$code}";
             $message = $this->Member_config['forgetpassword'];
             $message = str_replace(array('{$click}', '{$url}'), array('<a href="' . $url . '">请点击</a>', $url), $message);
             SendMail($info['email'], "会员密码找回", $message);
             $this->success("邮件已经发送到你注册邮箱!", U("Index/login"));
         } else {
             $this->error("邮箱地址有误!");
         }
     } else {
         if ($_GET['code']) {
             //设置密码
             $code = $this->_get("code");
             $code = authcode($code, 'DECODE');
             $password = genRandomString(6);
             $status = service("Passport")->user_edit($code, "", $password, "", 1);
             if ($status) {
                 $this->assign("waitSecond", 10000);
                 $this->success("密码初始化成功,新密码:" . $password . ",请尽快修改!", U("Index/login"));
                 exit;
             } else {
                 $this->error("密码初始失败,请联系管理员!");
             }
         }
         $this->display("Public:forget_password");
     }
 }
コード例 #29
0
function ftp_zip($conn_id, $directory, $list, $zipactions, $zipdir, $divelevel)
{
    // --------------
    // This function allows to download/save/email a zipfile which contains the selected directories and files
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result, $net2ftp_output;
    // -------------------------------------------------------------------------
    // Initialization
    // -------------------------------------------------------------------------
    if ($divelevel == 0) {
        // Create the zipfile
        $net2ftp_globals["zipfile"] = new zipfile();
        $timenow = time();
        $zipdir = "";
        // Open the connection
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // For all directories...
    // -------------------------------------------------------------------------
    for ($i = 1; $i <= $list["stats"]["directories"]["total_number"]; $i = $i + 1) {
        $newdir = glueDirectories($directory, $list["directories"][$i]["dirfilename"]);
        $newzipdir = glueDirectories($zipdir, $list["directories"][$i]["dirfilename"]);
        $newdivelevel = $divelevel + 1;
        // Check if the directory contains a banned keyword
        if ($list["directories"][$i]["selectable"] == "banned_keyword") {
            continue;
        }
        // Get a new list
        $newlist = ftp_getlist($conn_id, $newdir);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        ftp_zip($conn_id, $newdir, $newlist, $zipactions, $newzipdir, $newdivelevel);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
            continue;
        }
        if ($divelevel == 0 && ($zipactions["save"] == "yes" || $zipactions["email"] == "yes")) {
            $total = $list["stats"]["directories"]["total_number"] + $list["stats"]["files"]["total_number"];
            setStatus($i, $total, __("Processing the entries"));
        }
    }
    // end for directories
    // -------------------------------------------------------------------------
    // For all files...
    // -------------------------------------------------------------------------
    for ($i = 1; $i <= $list["stats"]["files"]["total_number"]; $i = $i + 1) {
        if ($list["files"][$i]["selectable"] != "ok") {
            continue;
        }
        $text = ftp_readfile($conn_id, $directory, $list["files"][$i]["dirfilename"]);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
            continue;
        }
        $filename = stripDirectory(glueDirectories($zipdir, $list["files"][$i]["dirfilename"]));
        $net2ftp_globals["zipfile"]->addFile($text, $filename);
        if ($divelevel == 0 && ($zipactions["save"] == "yes" || $zipactions["email"] == "yes")) {
            $total = $list["stats"]["directories"]["total_number"] + $list["stats"]["files"]["total_number"];
            setStatus($list["stats"]["directories"]["total_number"] + $i - 1, $total, __("Processing the entries"));
        }
    }
    // end for files
    // -------------------------------------------------------------------------
    // End
    // -------------------------------------------------------------------------
    if ($divelevel == 0) {
        // ------------------------
        // Send the zipfile to the browser
        // ------------------------
        if ($zipactions["download"] == "yes") {
            $timenow = time();
            $filenameToSend = "net2ftp-" . $timenow . ".zip";
            $filesizeToSend = strlen($net2ftp_globals["zipfile"]->file());
            sendDownloadHeaders($filenameToSend, $filesizeToSend);
            echo $net2ftp_globals["zipfile"]->file();
            flush();
        }
        // ------------------------
        // Save the zipfile string to a file
        // ------------------------
        if ($zipactions["save"] == "yes" || $zipactions["email"] == "yes") {
            $string = $net2ftp_globals["zipfile"]->file();
            $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "zip__");
            if ($tempfilename == false) {
                @unlink($tempfilename);
                $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]);
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
            registerTempfile("register", $tempfilename);
            local_writefile($tempfilename, $string);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        }
        // ------------------------
        // Save the zip file to the FTP server
        // ------------------------
        if ($zipactions["save"] == "yes") {
            ftp_putfile($conn_id, "", $tempfilename, $directory, $zipactions["save_filename"], FTP_BINARY, "copy");
            if ($net2ftp_result["success"] == false) {
                @unlink($tempfilename);
                //				$errormessage = __("Unable to put the file <b>%1\$s</b> on the FTP server.<br />You may not have write permissions on the directory.", $zipactions["save_filename"]);
                //				setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            } else {
                $net2ftp_output["ftp_zip"][] = __("The zip file has been saved on the FTP server as <b>%1\$s</b>", $zipactions["save_filename"]) . "<br /><br />\n";
            }
        }
        // ------------------------
        // Close the connection
        // ------------------------
        ftp_closeconnection($conn_id);
        // ------------------------
        // Email
        // ------------------------
        if ($zipactions["email"] == "yes") {
            $FromName = "net2ftp";
            $From = $net2ftp_settings["email_feedback"];
            $ToName = "";
            $To = $zipactions["email_to"];
            $Subject = __("Requested files");
            // Email message
            $Text = __("Dear,") . "\n\n";
            $Text .= __("Someone has requested the files in attachment to be sent to this email account (%1\$s).", $To) . "\n";
            $Text .= __("If you know nothing about this or if you don't trust that person, please delete this email without opening the Zip file in attachment.") . "\n";
            $Text .= __("Note that if you don't open the Zip file, the files inside cannot harm your computer.") . "\n";
            $Text .= "\n\n---------------------------------------\n";
            $Text .= __("Information about the sender: ") . "\n";
            $Text .= __("IP address: ") . $REMOTE_ADDR . "\n";
            $Text .= __("Time of sending: ") . mytime() . "\n";
            $Text .= __("Sent via the net2ftp application installed on this website: ") . $HTTP_REFERER . "\n";
            $Text .= __("Webmaster's email: ") . $From . "\n";
            $Text .= "\n\n---------------------------------------\n";
            $Text .= __("Message of the sender: ") . "\n";
            $Text .= $zipactions["message"] . "\n";
            $Text .= "\n\n---------------------------------------\n";
            $Text .= __("net2ftp is free software, released under the GNU/GPL license. For more information, go to http://www.net2ftp.com.") . "\n\n\n";
            $AttmFiles = array($tempfilename);
            SendMail($From, $FromName, $To, $ToName, $Subject, $Text, $Html, $AttmFiles);
            if ($net2ftp_result["success"] == false) {
                @unlink($tempfilename);
                return false;
            }
            $net2ftp_output["ftp_zip"][] = __("The zip file has been sent to <b>%1\$s</b>.", $To) . "<br /><br />";
        }
        // ------------------------
        // Delete the temporary zipfile
        // ------------------------
        if ($zipactions["save"] == "yes" || $zipactions["email"] == "yes") {
            $success4 = @unlink($tempfilename);
            if ($success4 == false) {
                $errormessage = __("Unable to delete the temporary file");
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
            registerTempfile("unregister", $tempfilename);
        }
        // Set the variable to NULL to save memory
        $net2ftp_globals["zipfile"] = NULL;
    }
    // end if $divelevel == 0
}
コード例 #30
0
 public function createorder()
 {
     if (!is_login()) {
         $this->error("您还没有登陆", U("User/login"));
     }
     /* 菜单调用*/
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /* 购物车调用*/
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /* 底部分类调用*/
     $menulist = R('Service/AllMenu');
     $this->assign('footermenu', $menulist);
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     $order = D("order");
     $tag = htmlspecialchars($_POST["tag"]);
     $value = $order->where("tag='{$tag}'")->getField('id');
     isset($value) && $this->error('重复提交订单');
     //获取会员uid
     $uid = D("member")->uid();
     //根据订单id获取购物清单
     $del = M("shoplist")->where("tag='{$tag}'")->select();
     //遍历购物清单,删除登录用户购物车中的货物id
     foreach ($del as $k => $val) {
         //获取购物清单数据表产品id,字段goodid
         $delbyid = $val["goodid"];
         //删除购物车中用户的产品id
         M("shopcart")->where("goodid='{$delbyid}'and uid='{$uid}'")->delete();
     }
     //计算提交的订单的商品总额
     $total = $this->getPricetotal($tag);
     //计算提交的订单的商品运费
     if ($total < C('LOWWEST')) {
         $trans = C('SHIPMONEY');
     } else {
         $trans = 0;
     }
     //计算提交的积分兑换
     if (htmlspecialchars($_POST["score"])) {
         $score = htmlspecialchars($_POST["score"]);
         //读取配置,1000积分兑换1元
         $ratio = $score / C('RATIO');
         $data['score'] = $score;
         $user = session('user_auth');
         $uid = D("member")->uid();
         M("member")->where("uid='{$uid}'")->setDec('score', $score);
     } else {
         $ratio = 0;
     }
     //计算提交的优惠券
     $code = htmlspecialchars($_POST["couponcode"]);
     //计算提交的订单的费用(含运费)
     $xfee = $total + $trans - $ratio;
     //计算优惠券可使用的金额,home/common/function
     $decfee = get_fcoupon_fee($code, $xfee);
     $data['codeid'] = $code;
     $data['codemoney'] = $decfee;
     $senderid = htmlspecialchars($_POST["sender"]);
     $data['addressid'] = $senderid;
     $data['total'] = $total;
     $data['create_time'] = NOW_TIME;
     $data['shipprice'] = $trans;
     //计算提交的订单的总费用
     $all = $total + $trans - $ratio - $decfee;
     $data['pricetotal'] = $all;
     $data['orderid'] = $tag;
     $data['tag'] = $tag;
     $data['uid'] = $uid;
     //修改订单状态为用户已提交
     if (htmlspecialchars($_POST["PayType"]) == "1") {
         $pay = M("pay");
         $pay->create();
         $pay->money = $all;
         $pay->ratio = $ratio;
         $pay->total = $total;
         $pay->out_trade_no = $tag;
         $pay->yunfee = $trans;
         $pay->coupon = $decfee;
         $pay->uid = $uid;
         $pay->ratioscore = $score;
         $pay->couponcode = $code;
         $pay->addressid = $senderid;
         $pay->create_time = NOW_TIME;
         $pay->type = 2;
         //货到付款
         $pay->status = 1;
         $pay->add();
         $data['status'] = 1;
         $data['ispay'] = -1;
         //货到付款
         $data['backinfo'] = "已提交等待发货";
         //增加取消订单
         //根据订单id保存对应的费用数据
         $orderid = $order->add($data);
         M("shoplist")->where("tag='{$tag}'")->setField('orderid', $orderid);
         $this->assign('codeid', $tag);
         $mail = get_email($uid);
         //获取会员邮箱
         $title = "交易提醒";
         $content = "您在<a href=\"" . C('DAMAIN') . "\" target='_blank'>" . C('SITENAME') . '</a>提交了订单,订单号' . $tag;
         if (C('MAIL_PASSWORD')) {
             SendMail($mail, $title, $content);
         }
         $this->meta_title = '提交成功';
         $this->display('success');
     }
     if (htmlspecialchars($_POST["PayType"]) == "2") {
         //设置订单状态为用户为未能完成,不删除数据
         $data['backinfo'] = "等待支付";
         $data['ispay'] = "1";
         $data['status'] = "-1";
         //待支付
         //根据订单id保存对应的费用数据
         $orderid = $order->add($data);
         M("shoplist")->where("tag='{$tag}'")->setField('orderid', $orderid);
         $pay = M("pay");
         $pay->create();
         $pay->money = $all;
         $pay->ratio = $ratio;
         $pay->total = $total;
         $pay->out_trade_no = $tag;
         $pay->yunfee = $trans;
         $pay->coupon = $decfee;
         $pay->uid = $uid;
         $pay->ratioscore = $score;
         $pay->couponcode = $code;
         $pay->addressid = $senderid;
         $pay->create_time = NOW_TIME;
         $pay->type = 1;
         //在线支付
         $pay->status = 1;
         //待支付
         $pay->add();
         $this->meta_title = '订单支付';
         $this->assign('codeid', $tag);
         $this->assign('goodprice', $all);
         //支付页
         $this->display('Pay/index');
     }
 }