Ejemplo n.º 1
0
 public function findpassword()
 {
     if (isset($_POST['submit'])) {
         $name = isset($_POST['name']) ? $_POST['name'] : "";
         $txtRegSN = strtoupper($_POST['txtRegSN']);
         if (md5($txtRegSN) != _getcookie('checkcode')) {
             _message("验证码错误");
         }
         $regtype = null;
         if (_checkmobile($name)) {
             $regtype = 'mobile';
         }
         if (_checkemail($name)) {
             $regtype = 'email';
         }
         if ($regtype == null) {
             _message("帐号类型不正确!", null, 3);
         }
         $info = $this->DB()->GetOne("SELECT * FROM `@#_member` WHERE {$regtype} = '{$name}' LIMIT 1");
         if (!$info) {
             _message("帐号不存在");
         }
         header("location:" . WEB_PATH . "/member/finduser/find" . $regtype . "check" . "/" . _encrypt($name));
     }
     $title = "找回密码";
     include templates("user", "findpassword");
 }
Ejemplo n.º 2
0
 private function goods_user($uid = null, $gid = null, $num = null)
 {
     if ($uid == 'system_rand') {
         $uid = 0;
     }
     if ($uid == 'system_rand') {
         $username_email = array(0 => "@163.com", 1 => "@qq.com", 2 => "@126.com", 3 => "@139.com", 4 => "@sina.com", 5 => "@sohu.com");
         $username = rand(12345678, 987654321) . rand(1, 9) . $username_email[rand(0, 5)];
         $user_time = time();
         $user = $this->db->Query("INSERT INTO `@#_member` (`email`,`password`,`img`,`time`) VALUES ('{$username}','','photo/member.jpg','{$user_time}')");
         if (!$user) {
             _message("随机会员添加失败!");
         }
         return $this->db->insert_id();
     } else {
         if (_checkemail($uid)) {
             $so = 'email';
         } else {
             if (_checkmobile($uid)) {
                 $so = 'mobile';
             } else {
                 $so = 'uid';
                 $uid = intval($uid);
             }
         }
         $good_info = $gid;
         $reg = $this->db->GetOne("select * from `@#_member` where `{$so}` = '{$uid}' limit 1");
         $money = $good_info['yunjiage'] * $num;
         if ($reg && $reg['money'] >= $money) {
             return $reg;
         } else {
             _message("没有该会员或该会员账户资金不够购买 {$num} 次商品");
         }
     }
 }
Ejemplo n.º 3
0
 public function quanzi_update()
 {
     $id = intval($this->segment(4));
     $quanzi = $this->db->GetOne("select * from `@#_quanzi` where `id`='{$id}'");
     $member = $this->db->GetOne("select email,mobile from `@#_member` where `uid`='{$quanzi['guanli']}'");
     if (!$quanzi) {
         _message("参数错误");
     }
     if (isset($_POST["submit"])) {
         if ($_POST['title'] == null) {
             _message("圈子名不能为空");
         }
         $title = htmlspecialchars($_POST['title']);
         $glfatie = htmlspecialchars($_POST['glfatie']);
         $guanli = htmlspecialchars($_POST['guanli']);
         $checkemail = _checkemail($guanli);
         $checkemobile = _checkmobile($guanli);
         if ($checkemail === false && $checkemobile === false) {
             _message("圈子管理员信息填写错误");
         }
         $res = $this->db->GetOne("SELECT uid FROM `@#_member` WHERE `email`='{$guanli}' or `mobile`='{$guanli}'");
         if (empty($res)) {
             _message("圈子管理员不存在");
         } else {
             $guanli = $res['uid'];
         }
         $jiaru = $_POST['jiaru'];
         $jianjie = htmlspecialchars($_POST['jianjie']);
         $gongao = htmlspecialchars($_POST['gongao']);
         $time = time();
         $img = htmlspecialchars($_POST['img']);
         $this->db->Query("UPDATE `@#_quanzi` SET title='{$title}',img='{$img}',glfatie='{$glfatie}',guanli='{$guanli}',jianjie='{$jianjie}',gongao='{$gongao}',jiaru='{$jiaru}',time='{$time}' where`id`='{$id}'");
         _message("修改成功");
     }
     include $this->tpl(ROUTE_M, 'quanzi.update');
 }
Ejemplo n.º 4
0
 public function register()
 {
     $config_email = System::load_sys_config("email");
     $config_mobile = System::load_sys_config("mobile");
     if (isset($_POST['submit'])) {
         $name = isset($_POST['name']) ? $_POST['name'] : "";
         $userpassword = isset($_POST['userpassword']) ? $_POST['userpassword'] : "";
         $userpassword2 = isset($_POST['userpassword2']) ? $_POST['userpassword2'] : "";
         if ($name == null or $userpassword == null or $userpassword2 == null) {
             _message("帐号密码不能为空", null, 3);
         }
         if (!(_checkmobile($name) or _checkemail($name))) {
             _message("帐号不是手机或邮箱", null, 3);
         }
         if (strlen($userpassword) < 6 || strlen($userpassword) > 20) {
             _message("密码小于6位或大于20位", null, 3);
         }
         if ($userpassword != $userpassword2) {
             _message("两次密码不一致", null, 3);
         }
         $regtype = null;
         if (_checkmobile($name)) {
             $regtype = 'mobile';
             $cfg_mobile_type = 'cfg_mobile_' . $config_mobile['cfg_mobile_on'];
             $config_mobile = $config_mobile[$cfg_mobile_type];
             if (empty($config_mobile['mid']) && empty($config_email['mpass'])) {
                 _message("系统短信配置不正确!");
             }
         }
         if (_checkemail($name)) {
             $regtype = 'email';
             if (empty($config_email['user']) && empty($config_email['pass'])) {
                 _message("系统邮箱配置不正确!");
             }
         }
         if ($regtype == null) {
             _message("注册类型不正确!", null, 3);
         }
         $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `{$regtype}` = '{$name}' or `reg_key` = '{$name}' LIMIT 1");
         if (is_array($member)) {
             _message("该账号已被注册!", WEB_PATH . '/register');
         }
         $time = time();
         $userpassword = md5($userpassword);
         $codetype = $regtype . 'code';
         $decode = _encrypt($this->segment(4), "DECODE");
         $decode = intval($decode);
         //邮箱验证 -1 代表未验证, 1 验证成功 都不等代表等待验证
         $sql = "INSERT INTO `@#_member`(password,img,emailcode,mobilecode,reg_key,yaoqing,time)VALUES('{$userpassword}','photo/member.jpg','-1','-1','{$name}','{$decode}','{$time}')";
         if ($this->db->Query($sql)) {
             $check_code = serialize(array("name" => $name, "time" => $time));
             $check_code = _encrypt($check_code, "ENCODE", '', 3600 * 24);
             header("location:" . WEB_PATH . "/member/user/" . $regtype . "check" . "/" . $check_code);
             exit;
         } else {
             _message("注册失败!", WEB_PATH . '/register');
         }
     }
     $title = "注册" . _cfg("web_name");
     include templates("user", "register");
 }
Ejemplo n.º 5
0
 public function checkname()
 {
     $config_email = System::load_sys_config("email");
     $config_mobile = System::load_sys_config("mobile");
     $user = array();
     $name = $this->segment(4);
     $regtype = null;
     if (_checkmobile($name)) {
         $regtype = 'mobile';
         $cfg_mobile_type = 'cfg_mobile_' . $config_mobile['cfg_mobile_on'];
         $config_mobile = $config_mobile[$cfg_mobile_type];
         if (empty($config_mobile['mid']) && empty($config_email['mpass'])) {
             $user['state'] = 2;
             //_message("系统短息配置不正确!");
             echo json_encode($user);
             exit;
         }
     }
     $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `mobile` = '{$name}' LIMIT 1");
     if (is_array($member)) {
         if ($member['mobilecode'] == 1 || $member['emailcode'] == 1) {
             $user['state'] = 1;
             //_message("该账号已被注册");
         } else {
             $sql = "DELETE from`@#_member` WHERE `mobile` = '{$name}'";
             $this->db->Query($sql);
             $user['state'] = 0;
         }
     } else {
         $user['state'] = 0;
         //表示数据库里没有该帐号
     }
     echo json_encode($user);
 }
Ejemplo n.º 6
0
 public function register()
 {
     $config_email = System::load_sys_config("email");
     $config_mobile = System::load_sys_config("mobile");
     $regconfig = System::load_app_config("user_reg_type", "", ROUTE_M);
     if ($this->userinfo) {
         header("Location:" . WEB_PATH . "/member/home/");
         exit;
     }
     if (isset($_POST['submit'])) {
         $name = isset($_POST['name']) ? $_POST['name'] : "";
         $userpassword = isset($_POST['userpassword']) ? $_POST['userpassword'] : "";
         $userpassword2 = isset($_POST['userpassword2']) ? $_POST['userpassword2'] : "";
         if ($name == null or $userpassword == null or $userpassword2 == null) {
             _message("帐号密码不能为空", null, 3);
         }
         if (!(_checkmobile($name) or _checkemail($name))) {
             _message("帐号不是手机或邮箱", null, 3);
         }
         if (strlen($userpassword) < 6 || strlen($userpassword) > 20) {
             _message("密码小于6位或大于20位", null, 3);
         }
         if ($userpassword != $userpassword2) {
             _message("两次密码不一致", null, 3);
         }
         $regtype = null;
         if (_checkmobile($name)) {
             $regtype = 'mobile';
             $cfg_mobile_type = 'cfg_mobile_' . $config_mobile['cfg_mobile_on'];
             $config_mobile = $config_mobile[$cfg_mobile_type];
             if (empty($config_mobile['mid']) && empty($config_email['mpass'])) {
                 _message("系统短信配置不正确!");
             }
         }
         if (_checkemail($name)) {
             $regtype = 'email';
             if (empty($config_email['user']) && empty($config_email['pass'])) {
                 _message("系统邮箱配置不正确!");
             }
         }
         //验证注册类型
         $regtype_arr = System::load_app_config("user_reg_type", "", ROUTE_M);
         $regtypes = 'reg_' . $regtype;
         if (empty($regtype) || $regtype_arr[$regtypes] == 0) {
             if ($regtype == 'email') {
                 _message("网站未开启邮箱注册!", null, 3);
             }
             if ($regtype == 'mobile') {
                 _message("网站未开启手机注册!", null, 3);
             }
             _message("您注册的类型不正确!", null, 3);
         }
         $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `{$regtype}` = '{$name}' or `reg_key` = '{$name}' LIMIT 1");
         if (is_array($member) && $member[$regtype] == $name) {
             _message("该账号已被注册!", WEB_PATH . '/register');
         }
         $register_type = 'def';
         if (is_array($member) && $member['reg_key'] == $name) {
             $b_uid = $member['uid'];
             $b_user = $this->db->GetOne("SELECT * FROM `@#_member_band` WHERE `b_uid` = '{$b_uid}' LIMIT 1");
             if (is_array($b_user)) {
                 _message("该账号已被注册!", WEB_PATH . '/register');
             }
             $register_type = 'for';
             //未注册成功在次注册
         }
         $time = time();
         $userpassword = md5($userpassword);
         $codetype = $regtype . 'code';
         $regcode = $this->segment(4);
         $regcode = !empty($regcode) ? $regcode : $_COOKIE['regcode'];
         $decode = _encrypt($regcode, "DECODE");
         $decode = intval($decode);
         //邮箱验证 -1 代表未验证, 1 验证成功 都不等代表等待验证
         if ($register_type == 'def') {
             $ip = _get_ip();
             $day_time = strtotime(date("Y-m-d"));
             $member_reg_num = $this->db->GetNum("SELECT uid FROM `@#_member` where `time` > '{$day_time}' and `user_ip` LIKE '%{$ip}%'");
             if ($member_reg_num >= $regconfig['reg_num']) {
                 _message("您今日注册会员数已经达到上限!");
             }
             $user_ip = _get_ip_dizhi();
             $sql = "INSERT INTO `@#_member`(password,user_ip,img,emailcode,mobilecode,reg_key,yaoqing,time)VALUES('{$userpassword}','{$user_ip}','photo/member.jpg','-1','-1','{$name}','{$decode}','{$time}')";
             $sqlreg = $this->db->Query($sql);
             $check_code = serialize(array("name" => $name, "time" => $time));
             $check_code = _encrypt($check_code, "ENCODE", '', 3600 * 24);
         } elseif ($register_type == 'for') {
             $sqlreg = true;
             $check_code = serialize(array("name" => $name, "time" => $member['time']));
             $check_code = _encrypt($check_code, "ENCODE", '', 3600 * 24);
         }
         if ($sqlreg) {
             header("location:" . WEB_PATH . "/member/user/" . $regtype . "check" . "/" . $check_code);
             exit;
         } else {
             _message("注册失败!", WEB_PATH . '/register');
         }
     }
     $p_c = $this->segment(4);
     if (!empty($p_c)) {
         setcookie("regcode", $p_c, time() + 3600 * 24 * 7);
     }
     $title = "注册" . _cfg("web_name");
     include templates("user", "register");
 }
Ejemplo n.º 7
0
 public function useraddress()
 {
     $mysql_model = System::load_sys_class('model');
     $member = $this->userinfo;
     $uid = $member['uid'];
     if (isset($_POST['submit'])) {
         foreach ($_POST as $k => $v) {
             $_POST[$k] = _htmtocode($v);
         }
         $sheng = isset($_POST['sheng']) ? $_POST['sheng'] : "";
         $shi = isset($_POST['shi']) ? $_POST['shi'] : "";
         $xian = isset($_POST['xian']) ? $_POST['xian'] : "";
         $jiedao = isset($_POST['jiedao']) ? $_POST['jiedao'] : "";
         $youbian = isset($_POST['youbian']) ? $_POST['youbian'] : "";
         $shouhuoren = isset($_POST['shouhuoren']) ? $_POST['shouhuoren'] : "";
         $tell = isset($_POST['tell']) ? $_POST['tell'] : "";
         $mobile = isset($_POST['mobile']) ? $_POST['mobile'] : "";
         $time = time();
         if ($sheng == null or $jiedao == null or $shouhuoren == null or $mobile == null) {
             echo "带星号不能为空;";
             exit;
         }
         if (!_checkmobile($mobile)) {
             echo "手机号错误;";
             exit;
         }
         $member_dizhi = $mysql_model->GetOne("select * from `@#_member_dizhi` where `uid`='" . $member['uid'] . "'");
         if (!$member_dizhi) {
             $default = "Y";
         } else {
             $default = "N";
         }
         $mysql_model->Query("INSERT INTO `@#_member_dizhi`(`uid`,`sheng`,`shi`,`xian`,`jiedao`,`youbian`,`shouhuoren`,`tell`,`mobile`,`default`,`time`)VALUES\n\t\t\t('{$uid}','{$sheng}','{$shi}','{$xian}','{$jiedao}','{$youbian}','{$shouhuoren}','{$tell}','{$mobile}','{$default}','{$time}')");
         _messagemobile("收货地址添加成功", WEB_PATH . "/mobile/home", 3);
     }
 }
Ejemplo n.º 8
0
 public function fileaction()
 {
     set_time_limit(0);
     ignore_user_abort(true);
     //检测用户断开
     if ($_FILES["file"]["type"] == "text/plain" && $_FILES["file"]["size"] < 2000000) {
         if ($_FILES["file"]["error"] > 0) {
             echo "Error: " . $_FILES["file"]["error"] . "<br />";
             return;
         }
     } else {
         echo "文件太大---或者不是txt文件";
         return;
     }
     //设定统计变量
     $tems = 0;
     $file = fopen($_FILES["file"]["tmp_name"], "r") or exit("Unable to open file!");
     while (!feof($file)) {
         $line = fgets($file);
         //中文处理
         $encode = mb_detect_encoding($line, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5"));
         if ($encode == "EUC-CN") {
             $line = iconv("EUC-CN", "UTF-8", $line);
         }
         $line = $this->trimall($line);
         if (!$line) {
             continue;
         }
         $linearray = explode(',', $line);
         if (count($linearray) != 4) {
             continue;
         }
         $username = $linearray[0];
         //用户名
         $password = $linearray[1];
         //密码
         $email = isset($linearray[2]) ? $linearray[2] : -1;
         //邮箱
         $mobile = isset($linearray[3]) ? $linearray[3] : -1;
         //手机
         if (!$password) {
             $password = md5('111111');
         } else {
             $password = md5($password);
         }
         $member_e = array();
         $member_m = array();
         $sql = "";
         $time = time();
         if ($email != -1) {
             if (_checkemail($email)) {
                 $member_e = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `email` = '{$email}' LIMIT 1");
             }
         }
         if ($mobile != -1) {
             if (_checkmobile($mobile)) {
                 $member_m = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `mobile` = '{$mobile}' LIMIT 1");
             }
         }
         if (is_array($member_e)) {
             if (!is_array($member_m)) {
                 $sql = "INSERT INTO `@#_member`(username,password,mobile,img,emailcode,mobilecode,time,auto_user)VALUES('{$username}','{$password}','{$mobile}','photo/member.jpg','-1','1','{$time}','1')";
                 $this->db->Query($sql);
                 $tems++;
             }
         } else {
             if (is_array($member_m)) {
                 $sql = "INSERT INTO `@#_member`(username,password,email,img,emailcode,mobilecode,time,auto_user)VALUES('{$username}','{$password}','{$email}','photo/member.jpg','1','-1','{$time}','1')";
             } else {
                 $sql = "INSERT INTO `@#_member`(username,password,email,mobile,img,emailcode,mobilecode,time,auto_user)VALUES('{$username}','{$password}','{$email}','{$mobile}','photo/member.jpg','1','1','{$time}','1')";
             }
             $this->db->Query($sql);
             $tems++;
         }
     }
     fclose($file);
     //输出自动注册成功条数
     echo "批量执行成功了:" . $tems . "条";
 }