public function login() { $user = $this->userinfo; if ($user) { header("Location:" . G_WEB_PATH); exit; } else { if (!$this->segment(4)) { global $_cfg; $url = WEB_PATH . '/' . $_cfg['param_arr']['url']; $url = rtrim($url, '/'); $url .= '/' . base64_encode(trim(G_HTTP_REFERER)); if ($url != get_web_url()) { header("Location:" . $url); exit; } } } if (isset($_POST['submit'])) { $username = $_POST['username']; $password = md5($_POST['password']); $logintype = ''; if (strpos($username, '@') == false) { //手机 $logintype = 'mobile'; if (!_checkmobile($username)) { _message("手机格式不正确!"); } } else { //邮箱 $logintype = 'email'; if (!_checkemail($username)) { _message("邮箱格式不正确!"); } } $member = $this->db->GetOne("select * from `@#_member` where `{$logintype}`='{$username}' and `password`='{$password}'"); if (!$member) { _message("帐号不存在错误!"); } $check = $logintype . 'code'; if ($member[$check] != 1) { $strcode = _encrypt($member['email']); _message("帐号未认证", WEB_PATH . "/member/user/" . $logintype . "check/" . _encrypt($member[$logintype])); } if (!is_array($member)) { _message("帐号或密码错误", NULL, 3); } else { $user_ip = _get_ip_dizhi(); $this->db->GetOne("UPDATE `@#_member` SET `user_ip` = '{$user_ip}' where `uid` = '{$member['uid']}'"); _setcookie("uid", _encrypt($member['uid']), 60 * 60 * 24 * 7); _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email'])), 60 * 60 * 24 * 7); } _message("登录成功", base64_decode($this->segment(4)), 2); } include templates("user", "login"); }
private function set_dingdan($pay_type = '', $dingdanzhui = '') { $uid = $this->members['uid']; $uphoto = $this->members['img']; $username = get_user_name($this->members); $insert_html = ''; $this->dingdancode = $dingdancode = pay_get_dingdan_code($dingdanzhui); //订单号 if (count($this->shoplist) > 1) { $dingdancode_tmp = 1; //多个商品相同订单 } else { $dingdancode_tmp = 0; //单独商品订单 } $ip = _get_ip_dizhi(); //订单时间 $time = sprintf("%.3f", microtime(true)); $this->MoenyCount = 0; foreach ($this->shoplist as $key => $shop) { $ret_data = array(); pay_get_shop_codes($shop['cart_gorenci'], $shop, $ret_data); $this->dingdan_query = $ret_data['query']; if (!$ret_data['query']) { $this->dingdan_query = false; } $codes = $ret_data['user_code']; //得到的购买码 $codes_len = intval($ret_data['user_code_len']); //得到购买码个数 $money = $codes_len * $shop['yunjiage']; //单条商品的总价格 $this->MoenyCount += $money; //总价格 $status = '未付款,未发货,未完成'; $shop['canyurenshu'] = intval($shop['canyurenshu']) + $codes_len; $shop['goods_count_num'] = $codes_len; $this->shoplist[$key] = $shop; if ($codes_len) { $insert_html .= "('{$dingdancode}','{$dingdancode_tmp}','{$uid}','{$username}','{$uphoto}','{$shop['id']}','{$shop['title']}','{$shop['qishu']}','{$codes_len}','{$money}','{$codes}','{$pay_type}','{$ip}','{$status}','{$time}'),"; } } $sql = "INSERT INTO `@#_member_go_record` (`code`,`code_tmp`,`uid`,`username`,`uphoto`,`shopid`,`shopname`,`shopqishu`,`gonumber`,`moneycount`,`goucode`,`pay_type`,`ip`,`status`,`time`) VALUES "; $sql .= trim($insert_html, ','); if (empty($insert_html)) { return false; } //$this->db->Query("set global max_allowed_packet = 2*1024*1024*10"); return $this->db->Query($sql); }
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 singleinsert() { $member = $this->userinfo; $uid = _getcookie('uid'); $ushell = _getcookie('ushell'); $title = "添加晒单"; $recordid = intval($this->segment(4)); $shopid = $recordid; $shaidan = $this->db->GetOne("select * from `@#_member_go_record` where `id`='{$recordid}' and `uid` = '{$member['uid']}'"); if (!$shaidan) { _message("该商品您不可晒单!"); } $shaidanyn = $this->db->GetOne("select sd_id from `@#_shaidan` where `sd_shopid`='{$recordid}' and `sd_userid` = '{$member['uid']}'"); if ($shaidanyn) { _message("不可重复晒单!"); } $ginfo = $this->db->GetOne("select id,sid,qishu from `@#_shoplist` where `id`='{$shaidan['shopid']}' LIMIT 1"); if (!$ginfo) { _message("该商品已不存在!"); } if (isset($_POST['submit'])) { if ($_POST['title'] == null) { _messagemobile("标题不能为空"); } if ($_POST['content'] == null) { _messagemobile("内容不能为空"); } System::load_sys_class('upload', 'sys', 'no'); $img = $_POST['fileurl_tmp']; $num = count($img); $pic = ""; for ($i = 0; $i < $num; $i++) { $pic .= trim($img[$i]) . ";"; } $src = trim($img[0]); $size = getimagesize(G_UPLOAD . $src); $width = 220; $height = $size[1] * ($width / $size[0]); $src_houzhui = upload::thumbs($width, $height, false, G_UPLOAD . '/' . $src); $thumbs = $src . "_" . intval($width) . intval($height) . "." . $src_houzhui; $sd_userid = $this->userinfo['uid']; $sd_shopid = $ginfo['id']; $sd_shopsid = $ginfo['sid']; $sd_qishu = $ginfo['qishu']; $sd_title = _htmtocode($_POST['title']); $path = 'shaidan/'; $sd_thumbs = $path . $_POST['shaitu'] . '.jpg'; $sd_content = $_POST['content']; $sd_photolist = $path . $_POST['shaitu'] . '.jpg;'; $sd_time = time(); $sd_ip = _get_ip_dizhi(); $this->db->Query("INSERT INTO `@#_shaidan`(`sd_userid`,`sd_shopid`,`sd_shopsid`,`sd_qishu`,`sd_ip`,`sd_title`,`sd_thumbs`,`sd_content`,`sd_photolist`,`sd_time`)VALUES\n\t\t\t('{$sd_userid}','{$sd_shopid}','{$sd_shopsid}','{$sd_qishu}','{$sd_ip}','{$sd_title}','{$sd_thumbs}','{$sd_content}','{$sd_photolist}','{$sd_time}')"); _messagemobile("晒单分享成功", WEB_PATH . "/mobile/home/singlelist"); } include templates("mobile/user", "singleinsert"); }
private function qq_set_member($uid = null, $type = 'bind_add_login') { $member_db = System::load_app_class('base', 'member'); $memberone = $member_db->get_user_info(); if ($memberone) { _message("该QQ号已经被其他用户所绑定!", WEB_PATH . '/login'); } $member = $this->db->GetOne("select uid,password,mobile,email from `@#_member` where `uid` = '{$uid}' LIMIT 1"); $_COOKIE['uid'] = null; $_COOKIE['ushell'] = null; $_COOKIE['UID'] = null; $_COOKIE['USHELL'] = null; $time = time(); $user_ip = _get_ip_dizhi(); $this->db->GetOne("UPDATE `@#_member` SET `user_ip` = '{$user_ip}',`login_time` = '{$time}' where `uid` = '{$uid}'"); $s1 = _setcookie("uid", _encrypt($member['uid']), 60 * 60 * 24 * 7); $s2 = _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email'])), 60 * 60 * 24 * 7); $domain = System::load_sys_config('domain'); if (isset($domain[$_SERVER['HTTP_HOST']])) { if ($domain[$_SERVER['HTTP_HOST']]['m'] == 'mobile') { $callback_url = WEB_PATH . "/mobile/home"; } else { $callback_url = WEB_PATH . "/member/home"; } } else { $callback_url = WEB_PATH . "/member/home"; } if ($s1 && $s2) { if (!$member['email'] || !$member['mobile']) { _message("登录成功,请绑定邮箱或手机号和及时修改默认密码!", $callback_url); } _message("登录成功!", $callback_url); } else { _message("登录失败请检查cookie!", G_WEB_PATH); } }
public function singleinsert() { $member = $this->userinfo; $uid = _getcookie('uid'); $ushell = _getcookie('ushell'); $title = "添加晒单"; if (isset($_POST['submit'])) { if ($_POST['title'] == null) { _message("标题不能为空"); } if ($_POST['content'] == null) { _message("内容不能为空"); } if (!isset($_POST['fileurl_tmp'])) { _message("图片不能为空"); } System::load_sys_class('upload', 'sys', 'no'); $img = $_POST['fileurl_tmp']; $num = count($img); $pic = ""; for ($i = 0; $i < $num; $i++) { $pic .= trim($img[$i]) . ";"; } $src = trim($img[0]); if (!file_exists(G_UPLOAD . $src)) { _message("晒单图片不正确"); } $size = getimagesize(G_UPLOAD . $src); $width = 220; $height = $size[1] * ($width / $size[0]); $src_houzhui = upload::thumbs($width, $height, false, G_UPLOAD . '/' . $src); $thumbs = $src . "_" . intval($width) . intval($height) . "." . $src_houzhui; $uid = $this->userinfo; $sd_userid = $uid['uid']; $sd_shopid = $_POST['shopid']; $sd_title = $_POST['title']; $sd_thumbs = $thumbs; $sd_content = $_POST['content']; $sd_photolist = $pic; $sd_time = time(); $sd_ip = _get_ip_dizhi(); $this->db->Query("INSERT INTO `@#_shaidan`(`sd_userid`,`sd_shopid`,`sd_ip`,`sd_title`,`sd_thumbs`,`sd_content`,`sd_photolist`,`sd_time`)VALUES\n\t\t\t('{$sd_userid}','{$sd_shopid}','{$sd_ip}','{$sd_title}','{$sd_thumbs}','{$sd_content}','{$sd_photolist}','{$sd_time}')"); _message("晒单分享成功", WEB_PATH . "/member/home/singlelist"); } $recordid = intval($this->segment(4)); if ($recordid > 0) { $shaidan = $this->db->GetOne("select * from `@#_member_go_record` where `id`='{$recordid}'"); $shopid = $shaidan['shopid']; include templates("member", "singleinsert"); } else { _message("页面错误"); } }