예제 #1
0
 public function reg()
 {
     if (isset($_POST['submit-1'])) {
         $username = safe_replace($_POST['username']);
         if ($username != $_POST['username'] || empty($username)) {
             _message("用户名格式错误!");
         }
         if (_strlen($username) > 15) {
             _message("用户名长度为2-15个字符,1个汉字等于2个字符!");
         }
         $password1 = $_POST['password'];
         $password2 = $_POST['pwdconfirm'];
         if (empty($password2) || $password1 != $password2) {
             _message("2次密码不一致!");
         }
         if (!_checkemail($_POST['email'])) {
             _message("邮箱格式错误!");
         }
         $pmid = isset($_POST['mid']) ? intval($_POST['mid']) : 0;
         $password = md5($password2);
         $addtime = time();
         $ip = _get_ip();
         $this->db->Query("INSERT INTO `@#_admin` (`mid`, `username`, `userpass`, `useremail`, `addtime`, `logintime`, `loginip`) VALUES ('{$pmid}', '{$username}', '{$password}', '{$_POST['email']}','{$addtime}','0','{$ip}')");
         if ($this->db->affected_rows()) {
             $path = WEB_PATH . '/' . ROUTE_M . '/user/lists';
             _message("添加管理员成功!", $path);
         } else {
             _message("添加管理员失败!");
         }
     }
     include $this->tpl(ROUTE_M, 'user.reg');
 }
예제 #2
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");
 }
예제 #3
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} 次商品");
         }
     }
 }
예제 #4
0
 public function email()
 {
     if (isset($_POST['ajax'])) {
         $pemail = isset($_POST['email']) ? $_POST['email'] : '';
         if (_checkemail($pemail)) {
             echo 'yes';
         } else {
             echo 'no';
         }
     }
 }
예제 #5
0
 public function reg()
 {
     function randomkeys($length)
     {
         $pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ';
         for ($i = 0; $i < $length; $i++) {
             $key .= $pattern[mt_rand(0, 35)];
             //生成php随机数
         }
         return $key;
     }
     if (isset($_POST['submit-1'])) {
         $username = safe_replace($_POST['username']);
         if ($username != $_POST['username'] || empty($username)) {
             _message("用户名格式错误!");
         }
         if (_strlen($username) > 15) {
             _message("用户名长度为2-15个字符,1个汉字等于2个字符!");
         }
         $password1 = $_POST['password'];
         $password2 = $_POST['pwdconfirm'];
         if (empty($password2) || $password1 != $password2) {
             _message("2次密码不一致!");
         }
         if (!_checkemail($_POST['email'])) {
             _message("邮箱格式错误!");
         }
         $pmid = isset($_POST['mid']) ? intval($_POST['mid']) : 0;
         $password = md5($password2);
         $uid = $password;
         $addtime = time();
         $ip = _get_ip();
         $this->db->Query("INSERT INTO `@#_admin` (`uid`, `mid`, `username`, `userpass`, `useremail`, `addtime`, `logintime`, `loginip`) VALUES ('{$uid}', '{$pmid}', '{$username}', '{$password}', '{$_POST['email']}','{$addtime}','0','{$ip}')");
         if ($this->db->affected_rows()) {
             $path = WEB_PATH . ROUTE_M . '/user/lists';
             _message("添加管理员成功!", $path);
         } else {
             _message("添加管理员失败!");
         }
     }
     include $this->tpl(ROUTE_M, 'user.reg');
 }
예제 #6
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');
 }
예제 #7
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");
 }
예제 #8
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");
 }
 public function sendsuccess()
 {
     if (!isset($_POST['submit'])) {
         _message("参数错误", WEB_PATH . '/member/home/modify');
     }
     if (!isset($_POST['email']) || empty($_POST['email'])) {
         _message("邮箱地址不能为空!", WEB_PATH . '/member/home/modify');
     }
     if (!_checkemail($_POST['email'])) {
         _message("邮箱格式错误!", WEB_PATH . '/member/home/modify');
     }
     $config_email = System::load_sys_config("email");
     if (empty($config_email['user']) && empty($config_email['pass'])) {
         _message("系统邮箱配置不正确!", WEB_PATH . '/member/home/modify');
     }
     $member = $this->userinfo;
     $title = "发送成功";
     $email = $_POST['email'];
     $member2 = $this->db->GetOne("select * from `@#_member` where `email`='{$email}' and `uid` != '{$member['uid']}'");
     if (!empty($member2) && $member2['emailcode'] == 1) {
         _message("该邮箱已经存在,请选择另外的邮箱验证!", WEB_PATH . '/member/home/modify');
     }
     $strcode1 = $email . "," . $member['uid'] . "," . time();
     $strcode = _encrypt($strcode1);
     $tit = $this->_cfg['web_name_two'] . "激活注册邮箱";
     $content = '<span>请在24小时内绑定邮箱</span>,点击链接:<a href="' . WEB_PATH . '/member/home/emailcheckingok/' . $strcode . '">';
     $content .= WEB_PATH . '/member/home/emailcheckingok/' . $strcode . '</a>';
     $succ = _sendemail($email, '', $tit, $content, 'yes', 'no');
     if ($succ == 'no') {
         _message("邮件发送失败!", WEB_PATH . '/member/home/modify', 30);
     } else {
         include templates("member", "sendsuccess");
     }
 }
예제 #10
0
/**
*	发送电子邮件
*	@email 也可以是一个二维数组,包含邮件和用户名信息
**/
function _sendemail($email, $username = null, $title = '', $content = '', $yes = '', $no = '')
{
    System::load_sys_class("email", 'sys', "no");
    $config = System::load_sys_config('email');
    if (!$username) {
        $username = "";
    }
    if (!$yes) {
        $yes = "发送成功,如果没有收到,请到垃圾箱查看,\n请把" . $config['fromName'] . "设置为信任,方便以后接收邮件";
    }
    if (!$no) {
        $no = "发送失败,请重新点击发送";
    }
    if (!_checkemail($email)) {
        return false;
    }
    email::config($config);
    if (is_array($email)) {
        email::adduser($email);
    } else {
        email::adduser($email, $username);
    }
    $if = email::send($title, $content);
    if ($if) {
        return $yes;
    } else {
        return $no;
    }
}
예제 #11
0
 */
session_start();
error_reporting(0);
header("Content-Type: text/html; charset=UTF-8");
//如有必要一定要设置成utf-8
require dirname(__FILE__) . '/includes/common.inc.php';
//转换成硬路径
/*
 * 处理数据
 */
if ($_GET['action'] == register) {
    require 'includes/registe.inc.php';
    _check_code($_POST['code'], $_SESSION['code']);
    $_data['username'] = _checkusername($_POST['username'], 2, 20);
    $_data['userpwd'] = _checkpassword($_POST['pwd'], $_POST['pwd1']);
    $_data['email'] = _checkemail($_POST['email']);
    $_data['lastlogin'] = time();
    $_data['credits'] = 80;
    $_data['active'] = sha1(uniqid(rand(), true));
    //判断用户名是否被注册
    $pass = DB_PRE . 'ask_user';
    $query = "SELECT username FROM {$pass} WHERE username='******'username']}'";
    _is_repeat($query, '对不起用户名已经被注册了');
    $query = "SELECT email FROM {$pass} WHERE email='{$_data['email']}'";
    _is_repeat($query, '对不起该邮箱已经被注册了');
    //
    $query = "INSERT INTO {$pass}(\n\tactive,\n\tusername,\n\tpassword,\n\temail,\n\tgroupid,\n\tcredits,\n\tregip,\n\tlastlogin,\n\tbday\n\t)\n\tVALUES(\n\t'{$_data['active']}',\n\t'{$_data['username']}',\n\t'{$_data['userpwd']}',\n\t'{$_data['email']}',\n\t7,\n\t'{$_data['credits']}',\n\t'{$_SERVER["REMOTE_ADDR"]}',\n\t'{$_data['lastlogin']}',\n\tNOW()\n\t)";
    _query($query);
    /*
     * 判断是否注册成功  
     */
예제 #12
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 . "条";
 }