Exemplo n.º 1
0
 public function get_email_verify()
 {
     //开始生成邮箱验证码
     $verify_data['verify_code'] = rand(111111, 999999);
     $verify_data['email'] = $_REQUEST['user_email'];
     $verify_data['create_time'] = TIME_UTC;
     $verify_data['client_ip'] = CLIENT_IP;
     if ($vid = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "email_verify_code WHERE email='" . $verify_data['email'] . "'")) {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "email_verify_code", $verify_data, "UPDATE", "id=" . $vid);
     } else {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "email_verify_code", $verify_data, "INSERT");
     }
     $email_x = $verify_data['email'];
     send_user_verify_mail($email_x, $verify_data['verify_code']);
     $data['status'] = 1;
     $data['info'] = "验证邮件已经发送,请注意查收";
     ajax_return($data);
 }
Exemplo n.º 2
0
 function mail_check()
 {
     //links
     $g_links = get_link_by_id(14);
     $GLOBALS['tmpl']->assign("g_links", $g_links);
     if (app_conf("MAIL_ON") == 1) {
         $user_id = (int) $_REQUEST['uid'];
         //发邮件
         send_user_verify_mail($user_id);
         $user_email = $GLOBALS['db']->getOne("select email from " . DB_PREFIX . "user where id =" . $user_id);
         //开始关于跳转地址的解析
         $domain = explode("@", $user_email);
         $domain = $domain[1];
         $gocheck_url = '';
         switch ($domain) {
             case '163.com':
                 $gocheck_url = 'http://mail.163.com';
                 break;
             case '126.com':
                 $gocheck_url = 'http://www.126.com';
                 break;
             case 'sina.com':
                 $gocheck_url = 'http://mail.sina.com';
                 break;
             case 'sina.com.cn':
                 $gocheck_url = 'http://mail.sina.com.cn';
                 break;
             case 'sina.cn':
                 $gocheck_url = 'http://mail.sina.cn';
                 break;
             case 'qq.com':
                 $gocheck_url = 'http://mail.qq.com';
                 break;
             case 'foxmail.com':
                 $gocheck_url = 'http://mail.foxmail.com';
                 break;
             case 'gmail.com':
                 $gocheck_url = 'http://www.gmail.com';
                 break;
             case 'yahoo.com':
                 $gocheck_url = 'http://mail.yahoo.com';
                 break;
             case 'yahoo.com.cn':
                 $gocheck_url = 'http://mail.cn.yahoo.com';
                 break;
             case 'hotmail.com':
                 $gocheck_url = 'http://www.hotmail.com';
                 break;
             default:
                 $gocheck_url = "";
                 break;
         }
         $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['REGISTER_MAIL_SEND_SUCCESS']);
         $GLOBALS['tmpl']->assign("user_email", $user_email);
         $GLOBALS['tmpl']->assign("gocheck_url", $gocheck_url);
         //end
         $GLOBALS['tmpl']->display("user_register_email.html");
     }
 }
Exemplo n.º 3
0
 /**
  * 注册
  */
 public function doregister()
 {
     global_run();
     //验证码
     $verify = strim($_REQUEST['verify_code']);
     $data = check_field("verify_code", $verify, 0);
     if (!$data['status']) {
         ajax_return($data);
     }
     es_session::delete("verify");
     //ip限制
     $ip = CLIENT_IP;
     $ip_nums = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where login_ip = '" . $ip . "'");
     if ($ip_nums > intval(app_conf("IP_LIMIT_NUM")) && intval(app_conf("IP_LIMIT_NUM")) > 0) {
         $data['status'] = false;
         $data['info'] = $GLOBALS['lang']['IP_LIMIT_ERROR'];
         ajax_return($data);
     }
     require_once APP_ROOT_PATH . "system/model/user.php";
     $user_data = $_POST;
     foreach ($user_data as $k => $v) {
         $user_data[$k] = strim($v);
     }
     if ($user_data['user_pwd'] != $user_data['user_pwd_confirm']) {
         $data['status'] = false;
         $data['info'] = "您两次输入的密码不匹配";
         $data['field'] = "user_pwd_confirm";
         ajax_return($data);
     }
     if ($user_data['user_pwd'] == '') {
         $data['status'] = false;
         $data['info'] = "请输入密码";
         $data['field'] = "user_pwd";
         ajax_return($data);
     }
     $user_data['pid'] = $GLOBALS['ref_uid'];
     $res = save_user($user_data);
     if ($res['status'] == 1) {
         //自动订阅邮箱和手机
         if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mail_list where mail_address = '" . $user_data['email'] . "'") == 0) {
             $mail_item['city_id'] = intval($GLOBALS['city']['id']);
             $mail_item['mail_address'] = $user_data['email'];
             $mail_item['is_effect'] = app_conf("USER_VERIFY");
             $GLOBALS['db']->autoExecute(DB_PREFIX . "mail_list", $mail_item, 'INSERT', '', 'SILENT');
         }
         if ($user_data['mobile'] != '' && $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_list where mobile = '" . $user_data['mobile'] . "'") == 0) {
             $mobile['city_id'] = intval($GLOBALS['city']['id']);
             $mobile['mobile'] = $user_data['mobile'];
             $mobile['is_effect'] = app_conf("USER_VERIFY");
             $GLOBALS['db']->autoExecute(DB_PREFIX . "mobile_list", $mobile, 'INSERT', '', 'SILENT');
         }
         $user_id = intval($res['data']);
         //更新来路
         $GLOBALS['db']->query("update " . DB_PREFIX . "user set referer = '" . $GLOBALS['referer'] . "' where id = " . $user_id);
         $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
         if ($user_info['is_effect'] == 1) {
             //在此自动登录
             do_login_user($user_data['email'], $user_data['user_pwd']);
             //原来为直接挑战 现改为 完善资料
             showSuccess($GLOBALS['lang']['REGISTER_SUCCESS'], 1, get_gopreview());
         } else {
             //以下代码不会再被运行,因为USER_VERIFY不可再配置,固定为1
             if (app_conf("MAIL_ON") == 1) {
                 //发邮件
                 send_user_verify_mail($user_id);
                 $user_email = $GLOBALS['db']->getOne("select email from " . DB_PREFIX . "user where id =" . $user_id);
                 //开始关于跳转地址的解析
                 $domain = explode("@", $user_email);
                 $domain = $domain[1];
                 $gocheck_url = '';
                 switch ($domain) {
                     case '163.com':
                         $gocheck_url = 'http://mail.163.com';
                         break;
                     case '126.com':
                         $gocheck_url = 'http://www.126.com';
                         break;
                     case 'sina.com':
                         $gocheck_url = 'http://mail.sina.com';
                         break;
                     case 'sina.com.cn':
                         $gocheck_url = 'http://mail.sina.com.cn';
                         break;
                     case 'sina.cn':
                         $gocheck_url = 'http://mail.sina.cn';
                         break;
                     case 'qq.com':
                         $gocheck_url = 'http://mail.qq.com';
                         break;
                     case 'foxmail.com':
                         $gocheck_url = 'http://mail.foxmail.com';
                         break;
                     case 'gmail.com':
                         $gocheck_url = 'http://www.gmail.com';
                         break;
                     case 'yahoo.com':
                         $gocheck_url = 'http://mail.yahoo.com';
                         break;
                     case 'yahoo.com.cn':
                         $gocheck_url = 'http://mail.cn.yahoo.com';
                         break;
                     case 'hotmail.com':
                         $gocheck_url = 'http://www.hotmail.com';
                         break;
                     default:
                         $gocheck_url = "";
                         break;
                 }
                 //更新用户注册ip防止多次注册
                 $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . $ip . "' where id =" . $user_id);
                 $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['REGISTER_MAIL_SEND_SUCCESS']);
                 $GLOBALS['tmpl']->assign("user_email", $user_email);
                 $GLOBALS['tmpl']->assign("gocheck_url", $gocheck_url);
                 //end
                 //$GLOBALS['tmpl']->display("user_register_email.html");
                 showSuccess($GLOBALS['lang']['WAIT_VERIFY_USER'], 1, get_gopreview());
             } else {
                 showSuccess($GLOBALS['lang']['WAIT_VERIFY_USER'], 1, get_gopreview());
             }
         }
     } else {
         $error = $res['data'];
         $data['status'] = false;
         if (!$error['field_show_name']) {
             $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
             $data['field'] = $error['field_name'];
         }
         if ($error['error'] == EMPTY_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == FORMAT_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
         }
         if ($error['error'] == EXIST_ERROR) {
             $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
         }
         $data['info'] = $error_msg;
         ajax_return($data);
     }
 }
Exemplo n.º 4
0
 public function send()
 {
     $id = intval($_REQUEST['id']);
     $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $id);
     if (!$user_info) {
         showErr($GLOBALS['lang']['NO_THIS_USER']);
     }
     if ($user_info['is_effect'] == 1) {
         showErr($GLOBALS['lang']['HAS_VERIFIED']);
     }
     send_user_verify_mail($user_info['id']);
     showSuccess($GLOBALS['lang']['SEND_HAS_SUCCESS'], 0, APP_ROOT . "/");
 }