public function image() { $style = $this->segment(4); $cun_type = $this->segment(5); if ($cun_type == 'cookie' || $cun_type == 'session') { $cun_type = $this->segment(5); } else { $cun_type = 'cookie'; } $style = explode("_", $style); $width = isset($style[0]) ? intval($style[0]) : ''; $height = isset($style[1]) ? intval($style[1]) : ''; $color = isset($style[2]) ? $style[2] : ''; $bgcolor = isset($style[3]) ? $style[3] : ''; $lenght = isset($style[4]) ? intval($style[4]) : ''; $type = isset($style[5]) ? intval($style[5]) : ''; $checkcode = System::load_app_class("checkcodeimg"); $checkcode->config($width, $height, $color, $bgcolor, $lenght, $type); if (isset($_GET['dian'])) { $checkcode->dian(50, $color); } if ($cun_type == 'cookie') { _setcookie("checkcode", md5($checkcode->code)); } if ($cun_type == 'session') { _session_start(); $_SESSION['checkcode'] = md5($checkcode->code); } $checkcode->image(); }
public function cook_end() { _setcookie("uid", "", time() - 3600); _setcookie("ushell", "", time() - 3600); header("Location:" . WEB_PATH); // _message(WEB_PATH); }
public function cook_end() { _setcookie("uid", "", time() - 3600); _setcookie("ushell", "", time() - 3600); //_message("退出成功",WEB_PATH."/mobile/mobile/"); header("location: " . WEB_PATH . "/mobile/mobile/"); }
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"); }
public function image() { $style = $this->segment(4); $style = explode("_", $style); $width = isset($style[0]) ? intval($style[0]) : ''; $height = isset($style[1]) ? intval($style[1]) : ''; $color = isset($style[2]) ? $style[2] : ''; $bgcolor = isset($style[3]) ? $style[3] : ''; $lenght = isset($style[4]) ? intval($style[4]) : ''; $type = isset($style[5]) ? intval($style[5]) : ''; $checkcode = System::load_app_class("checkcodeimg"); $checkcode->config($width, $height, $color, $bgcolor, $lenght, $type); if (isset($_GET['dian'])) { $checkcode->dian(50, $color); } _setcookie("checkcode", md5($checkcode->code)); $checkcode->image(); }
public function mobileregsn() { $mobile = safe_replace($this->segment(4)); $checkcodes = $this->segment(5); $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `mobile` = '{$mobile}' LIMIT 1"); if (strlen($checkcodes) != 6) { //_message("验证码输入不正确!"); $mobileregsn['state'] = 1; echo json_encode($mobileregsn); exit; } $usercode = explode("|", $member['mobilecode']); if ($checkcodes != $usercode[0]) { //_message("验证码输入不正确!"); $mobileregsn['state'] = 1; echo json_encode($mobileregsn); exit; } $this->db->Query("UPDATE `@#_member` SET mobilecode='1' 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); $mobileregsn['state'] = 0; $mobileregsn['str'] = 1; echo json_encode($mobileregsn); }
public function houtai() { //file_put_contents("alipay.txt",var_export($_POST,true)); include G_SYSTEM . "modules/pay/lib/alipay/alipay_notify.class.php"; $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'alipay' and `pay_start` = '1'"); $pay_type_key = unserialize($pay_type['pay_key']); $key = $pay_type_key['key']['val']; //支付KEY $partner = $pay_type_key['id']['val']; //支付商号ID $alipay_config_sign_type = strtoupper('MD5'); //签名方式 不需修改 $alipay_config_input_charset = strtolower('utf-8'); //字符编码格式 $alipay_config_cacert = G_SYSTEM . "modules/pay/lib/alipay/cacert.pem"; //ca证书路径地址 $alipay_config_transport = 'http'; $alipay_config = array("partner" => $partner, "key" => $key, "sign_type" => $alipay_config_sign_type, "input_charset" => $alipay_config_input_charset, "cacert" => $alipay_config_cacert, "transport" => $alipay_config_transport); $alipayNotify = new AlipayNotify($alipay_config); $verify_result = $alipayNotify->verifyNotify(); if (!$verify_result) { echo "fail"; exit; } //验证失败 $out_trade_no = $_POST['out_trade_no']; //商户订单号 $trade_no = $_POST['trade_no']; //支付宝交易号 $trade_status = $_POST['trade_status']; //交易状态 //开始处理及时到账和担保交易订单 if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS' || $trade_status == 'WAIT_SELLER_SEND_GOODS') { $this->db->Autocommit_start(); $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `status` = '未付款' for update"); if (!$dingdaninfo) { echo "fail"; exit; } //没有该订单,失败 $c_money = intval($dingdaninfo['money']); $uid = $dingdaninfo['uid']; $time = time(); $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '支付宝', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'"); $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')"); $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')"); if ($up_q1 && $up_q2 && $up_q3) { $this->db->Autocommit_commit(); } else { $this->db->Autocommit_rollback(); echo "fail"; exit; } if (empty($dingdaninfo['scookies'])) { echo "success"; exit; //充值完成 } $scookies = unserialize($dingdaninfo['scookies']); $pay = System::load_app_class('pay', 'pay'); $pay->scookie = $scookies; $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record'); //闪购商品 if ($ok != 'ok') { _setcookie('Cartlist', NULL); echo "fail"; exit; //商品购买失败 } $check = $pay->go_pay(1); if ($check) { $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'"); _setcookie('Cartlist', NULL); echo "success"; exit; } else { echo "fail"; exit; } } //开始处理订单结束 }
public function findmobilecheck() { $title = "手机找回密码"; $time = 120; $namestr = $this->segment(4); $name = _encrypt($namestr, "DECODE"); if (strlen($name) != 11) { _message("参数错误!"); } $member = $this->DB()->GetOne("SELECT * FROM `@#_member` WHERE `mobile` = '{$name}' LIMIT 1"); if (!$member) { _message("参数不正确!"); } if ($member['passcode'] == -1) { //更新验证码 $randcode = rand(100000, 999999); $checkcodes = $randcode . '|' . time(); //验证码 $this->DB()->Query("UPDATE `@#_member` SET passcode='{$checkcodes}' where `uid`='{$member['uid']}'"); $sendok = _sendmobile($name, $randcode); if ($sendok[0] != 1) { _message($sendok[1]); } header("location:" . WEB_PATH . "/member/finduser/findmobilecheck/" . _encrypt($member['mobile'])); exit; } if (isset($_POST['submit'])) { $checkcodes = isset($_POST['checkcode']) ? $_POST['checkcode'] : _message("参数不正确!"); if (strlen($checkcodes) != 6) { _message("验证码输入不正确!"); } $usercode = explode("|", $member['passcode']); if ($checkcodes != $usercode[0]) { _message("验证码输入不正确!"); } $urlcheckcode = _encrypt($member['mobile'] . "|" . $member['passcode']); _setcookie("uid", _encrypt($member['uid'])); _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email']))); _message("手机验证成功", WEB_PATH . "/member/finduser/findok/" . $urlcheckcode, 2); } $enname = substr($name, 0, 3) . '****' . substr($name, 7, 10); $time = 120; include templates("user", "findmobilecheck"); }
case 'Twitter': return 'twitter'; case 'Vkontakte': return 'vk'; default: return false; } }; $data['list'] = h::{'ul.cs-hybrid-auth-providers-list li'}([$L->or_sign_in_with, ['class' => 'uk-nav-header']], array_map(function ($provider) use($L, $icon_mapper) { return [h::a(h::icon($icon_mapper($provider)) . $L->{$provider}), ['data-provider' => $provider, 'class' => "cs-hybrid-auth-{$provider}"]]; }, array_keys($providers))); }); Trigger::instance()->register('System/User/registration/confirmation/after', function () { if ($referer = _getcookie('HybridAuth_referer')) { header("Refresh: 5; url={$referer}"); _setcookie('HybridAuth_referer', ''); } }); Trigger::instance()->register('System/User/del/after', function ($data) { /** * @var \cs\DB\_Abstract $cdb */ $cdb = DB::instance()->{Config::instance()->module('HybridAuth')->db('integration')}(); $cdb->q(["DELETE FROM `[prefix]users_social_integration`\n\t\t\t\tWHERE `id` = '%s'", "DELETE FROM `[prefix]users_social_integration_contacts`\n\t\t\t\tWHERE `id` = '%s'"], $data['id']); }); Trigger::instance()->register('System/User/get_contacts', function ($data) { $data['contacts'] = array_unique(array_merge($data['contacts'], get_user_contacts($data['id']))); }); /** * Returns array of user id, that are contacts of specified user *
<?php /*********************************************** DAVE PHP API https://github.com/evantahler/PHP-DAVE-API Evan Tahler | 2011 I am an example of how to set cookies using the new modified functions for the DAVE server (which will still work on a traditional fastCGI server as well) ***********************************************/ $NewUpperLimit = rand(); $NewLowerLimit = rand(); _setcookie("UpperLimit", $NewUpperLimit); _setcookie("LowerLimit", $NewLowerLimit); $OUTPUT["COOKIE_TEST"]["OldUpperLimit"] = $PARAMS['UpperLimit']; $OUTPUT["COOKIE_TEST"]["NewUpperLimit"] = $NewUpperLimit; $OUTPUT["COOKIE_TEST"]["OldLowerLimit"] = $PARAMS['LowerLimit']; $OUTPUT["COOKIE_TEST"]["NewLowerLimit"] = $NewLowerLimit; $OUTPUT["COOKIE_TEST"]["NOTE"] = "The New limits should be set in your cookies. Load this page again to see the change as read by the API."; // _header("Location: /PHP-DAVE-API/not_a_folder/");
function synlogout($get, $post) { if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); _setcookie('auth', '', -86400 * 365); _setcookie('sid', '', -86400 * 365); _setcookie('loginuser', '', -86400 * 365); _setcookie('activationauth', '', -86400 * 365); }
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; $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); if ($s1 && $s2) { if (!$member['email'] || !$member['mobile']) { _message("登录成功,请绑定邮箱或手机号和及时修改默认密码!", WEB_PATH . '/member/home/modify'); } _message("登录成功!", G_WEB_PATH); } else { _message("登录失败请检查cookie!", G_WEB_PATH); } }
public function jf_paysuccess() { $_COOKIE['Cartlist_jf'] = NULL; _setcookie("Cartlist_jf", null); include templates("cart", "jf_paysuccess"); }
public function mobilecheck() { $title = "手机认证 - " . _cfg("web_name"); $check_code = _encrypt($this->segment(4), "DECODE"); $check_code = @unserialize($check_code); if (!$check_code || !isset($check_code['name']) || !isset($check_code['time'])) { _message("参数不正确或者验证已过期!", WEB_PATH . '/register'); } $name = $check_code['name']; $member = $this->db->GetOne("SELECT * FROM `@#_member` WHERE `reg_key` = '{$check_code['name']}' and `time` = '{$check_code['time']}' LIMIT 1"); if (!$member) { _message("未知的来源!", WEB_PATH . '/register'); } if ($member['mobilecode'] == '1') { _message("该账号验证成功", WEB_PATH . "/login"); } if ($member['mobilecode'] == '-1') { $sendok = send_mobile_reg_code($member['reg_key'], $member['uid']); if ($sendok[0] != 1) { _message($sendok[1]); } header("location:" . WEB_PATH . "/member/user/mobilecheck/" . $this->segment(4)); exit; } if (isset($_POST['submit'])) { $checkcodes = isset($_POST['checkcode']) ? $_POST['checkcode'] : _message("参数不正确!"); if (strlen($checkcodes) != 6) { _message("验证码输入不正确!"); } $usercode = explode("|", $member['mobilecode']); if ($checkcodes != $usercode[0]) { _message("验证码输入不正确!"); } $fili_cfg = System::load_app_config("user_fufen"); if ($member['yaoqing']) { $time = time(); $yaoqinguid = $member['yaoqing']; //福分、经验添加 if ($fili_cfg['f_visituser']) { $this->db->Query("insert into `@#_member_account` (`uid`,`type`,`pay`,`content`,`money`,`time`) values ('{$yaoqinguid}','1','福分','邀请好友奖励','{$fili_cfg['f_visituser']}','{$time}')"); } $this->db->Query("UPDATE `@#_member` SET `score`=`score`+'{$fili_cfg['f_visituser']}',`jingyan`=`jingyan`+'{$fili_cfg['z_visituser']}' where uid='{$yaoqinguid}'"); } $check = $this->db->Query("UPDATE `@#_member` SET mobilecode='1',mobile='{$member['reg_key']}' where `uid`='{$member['uid']}'"); _setcookie("uid", _encrypt($member['uid']), 60 * 60 * 24 * 7); _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['reg_key'] . $member['email'])), 60 * 60 * 24 * 7); _message("验证成功", WEB_PATH . "/login"); } $enname = substr($name, 0, 3) . '****' . substr($name, 7, 10); $time = 120; $namestr = $this->segment(4); include templates("user", "mobilecheck"); }
public function houtai() { $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'tenpay' and `pay_start` = '1'"); $pay_type_key = unserialize($pay_type['pay_key']); $key = $pay_type_key['key']['val']; //支付KEY $partner = $pay_type_key['id']['val']; //支付商号ID /* 创建支付应答对象 */ $resHandler = new ResponseHandler(); $resHandler->setKey($key); //判断签名 if (!$resHandler->isTenpaySign()) { echo "认证签名失败"; exit; } //通知ID $notify_id = $resHandler->getParameter("notify_id"); //通过通知ID查询,确保通知来至财付通 //创建查询请求 $queryReq = new RequestHandler(); $queryReq->init(); $queryReq->setKey($key); $queryReq->setGateUrl("https://gw.tenpay.com/gateway/simpleverifynotifyid.xml"); $queryReq->setParameter("partner", $partner); $queryReq->setParameter("notify_id", $notify_id); //通信对象 $httpClient = new TenpayHttpClient(); $httpClient->setTimeOut(5); //设置请求内容 $httpClient->setReqContent($queryReq->getRequestURL()); //后台调用 if ($httpClient->call()) { //设置结果参数 $queryRes = new ClientResponseHandler(); $queryRes->setContent($httpClient->getResContent()); $queryRes->setKey($key); } else { echo "通信失败"; exit; } //及时到账 if ($resHandler->getParameter("trade_mode") == "1") { //只有签名正确,retcode为0,trade_state为0才是支付成功 if ($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" && $resHandler->getParameter("trade_state") == "0") { //log_result("即时到帐验签ID成功"); //取结果参数做业务处理 $out_trade_no = $resHandler->getParameter("out_trade_no"); //财付通订单号 $transaction_id = $resHandler->getParameter("transaction_id"); //金额,以分为单位 $total_fee = $resHandler->getParameter("total_fee"); //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee $discount = $resHandler->getParameter("discount"); //------------------------------ //处理业务开始 //------------------------------ //处理数据库逻辑 //注意交易单不要重复处理 //注意判断返回金额 $total_fee_t = $total_fee / 100; $this->db->Autocommit_start(); $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `money` = '{$total_fee_t}' and `status` = '未付款' for update"); if (!$dingdaninfo) { echo "fail"; exit; } $time = time(); $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '财付通', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'"); $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$total_fee_t} where (`uid` = '{$dingdaninfo['uid']}')"); $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$dingdaninfo['uid']}', '1', '账户', '充值', '{$total_fee_t}', '{$time}')"); if ($up_q1 && $up_q2 && $up_q3) { $this->db->Autocommit_commit(); } else { $this->db->Autocommit_rollback(); echo "fail"; exit; } if (empty($dingdaninfo['scookies'])) { echo "success"; exit; } $uid = $dingdaninfo['uid']; $scookies = unserialize($dingdaninfo['scookies']); $pay = System::load_app_class('pay', 'pay'); $pay->scookie = $scookies; $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record'); //闪购商品 if ($ok != 'ok') { _setcookie('Cartlist', NULL); echo "fail"; exit; //商品购买失败 } $check = $pay->go_pay(1); if ($check) { $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'"); _setcookie('Cartlist', NULL); echo "success"; exit; } else { echo "fail"; exit; } //------------------------------ //处理业务完毕 //------------------------------ //log_result("即时到帐后台回调成功"); } else { echo "fail"; } } else { //通信失败 //echo "fail"; //后台调用通信失败,写日志,方便定位问题 //echo "<br>call err:" . $httpClient->getResponseCode() ."," . $httpClient->getErrInfo() . "<br>"; } }
public function mobilecheck() { $member = $this->userinfo; if (isset($_POST['submit'])) { $shoujimahao = base64_decode(_getcookie("mobilecheck")); if (!_checkmobile($shoujimahao)) { _messagemobile("手机号码错误!"); } $checkcodes = isset($_POST['mobile']) ? $_POST['mobile'] : _messagemobile("参数不正确!"); if (strlen($checkcodes) != 6) { _messagemobile("验证码输入不正确!"); } $usercode = explode("|", $member['mobilecode']); if ($checkcodes != $usercode[0]) { _messagemobile("验证码输入不正确!"); } $this->db->Query("UPDATE `@#_member` SET `mobilecode`='1',`mobile` = '{$shoujimahao}' where `uid`='{$member['uid']}'"); //夺宝币、经验添加 $isset_user = $this->db->GetList("select `uid` from `@#_member_account` where `content`='手机认证完善奖励' and `type`='1' and `uid`='{$member['uid']}' and (`pay`='经验' or `pay`='夺宝币')"); if (empty($isset_user)) { $config = System::load_app_config("user_fufen"); //夺宝币/经验 $time = time(); $this->db->Query("insert into `@#_member_account` (`uid`,`type`,`pay`,`content`,`money`,`time`) values ('{$member['uid']}','1','夺宝币','手机认证完善奖励','{$config['f_phonecode']}','{$time}')"); $this->db->Query("insert into `@#_member_account` (`uid`,`type`,`pay`,`content`,`money`,`time`) values ('{$member['uid']}','1','经验','手机认证完善奖励','{$config['z_phonecode']}','{$time}')"); $this->db->Query("UPDATE `@#_member` SET `score`=`score`+'{$config['f_phonecode']}',`jingyan`=`jingyan`+'{$config['z_phonecode']}' where uid='" . $member['uid'] . "'"); } _setcookie("uid", _encrypt($member['uid'])); _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email']))); //夺宝币、经验添加 $isset_user = $this->db->GetOne("select `uid` from `@#_member_account` where `pay`='手机认证完善奖励' and `type`='1' and `uid`='{$member['uid']}' or `pay`='经验'"); if (empty($isset_user)) { $config = System::load_app_config("user_fufen"); //夺宝币/经验 $time = time(); $this->db->Query("insert into `@#_member_account` (`uid`,`type`,`pay`,`content`,`money`,`time`) values ('{$member['uid']}','1','夺宝币','手机认证完善奖励','{$config['f_overziliao']}','{$time}')"); $this->db->Query("insert into `@#_member_account` (`uid`,`type`,`pay`,`content`,`money`,`time`) values ('{$member['uid']}','1','经验','手机认证完善奖励','{$config['z_overziliao']}','{$time}')"); $mysql_model->Query("UPDATE `@#_member` SET `score`=`score`+'{$config['f_overziliao']}',`jingyan`=`jingyan`+'{$config['z_overziliao']}' where uid='" . $member['uid'] . "'"); $this->db->Query("UPDATE `@#_member` SET score='100' where `uid`='{$member['uid']}'"); } echo "<script type='text/javascript'>alert('验证成功,请重新登录');</script>"; //_messagemobile("验证成功,请重新登录!",WEB_PATH."/mobile/home"); } else { _messagemobile("页面错误", null, 3); } }
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); } }
function synlogout($get, $post) { session_start(); if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } unregisterRole('user'); header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); _setcookie('Example_auth', '', -86400 * 365); }
function ts_synclogout() { session_start(); unset($_SESSION['mid'], $_SESSION['SITE_KEY']); // 注销session _setcookie('TSV4_LOGGED_USER', null); // 注销cookie }
$Config = Config::instance(); $L = Language::instance(); $Page = Page::instance(); $User = User::instance(); if (_getcookie('restore_password_confirm')) { _setcookie('restore_password_confirm', ''); $Page->title($L->restore_password_success_title); $Page->success($L->restore_password_success); return; } elseif (!$User->guest()) { $Page->title($L->you_are_already_registered_title); $Page->warning($L->you_are_already_registered); return; } elseif (!isset($Config->route[2])) { $Page->title($L->invalid_confirmation_code); $Page->warning($L->invalid_confirmation_code); return; } $result = $User->restore_password_confirmation($Config->route[2]); if ($result === false) { $Page->title($L->invalid_confirmation_code); $Page->warning($L->invalid_confirmation_code); return; } if (Mail::instance()->send_to($User->get('email', $result['id']), $L->restore_password_success_mail(get_core_ml_text('name')), $L->restore_password_success_mail_body($User->username($result['id']), get_core_ml_text('name'), $Config->core_url() . '/profile/settings', $User->get('login', $result['id']), $result['password']))) { _setcookie('restore_password_confirm', 1); header("Location: {$Config->base_url()}/System/profile/restore_password_confirmation"); } else { $Page->title($L->sending_reg_mail_error_title); $Page->warning($L->sending_reg_mail_error); }
function synlogout($get, $post) { if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } //note 同步登出 API 接口 header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); _setcookie('Example_auth', '', -86400 * 365); }
public function houtai() { $this->db = System::load_sys_class('model'); include_once dirname(__FILE__) . "/lib/wxpay/WxPayPubHelper.php"; //引入文件需求 if (!isset($_POST["out_trade_no"])) { $out_trade_no = " "; } else { $out_trade_no = $_POST["out_trade_no"]; //使用订单查询接口 $orderQuery = new OrderQuery_pub(); //设置必填参数 //appid已填,商户无需重复填写 //mch_id已填,商户无需重复填写 //noncestr已填,商户无需重复填写 //sign已填,商户无需重复填写 $orderQuery->setParameter("out_trade_no", "{$out_trade_no}"); //商户订单号 $time = time(); //file_put_contents("111.txt",$out_trade_no."----".$time."\n",FILE_APPEND); //非必填参数,商户可根据实际情况选填 //$orderQuery->setParameter("sub_mch_id","XXXX");//子商户号 //$orderQuery->setParameter("transaction_id","XXXX");//微信订单号 //获取订单查询结果 $orderQueryResult = $orderQuery->getResult(); //商户根据实际情况设置相应的处理流程,此处仅作举例 if ($orderQueryResult["return_code"] == "FAIL") { echo "通信出错:" . $orderQueryResult['return_msg'] . "<br>"; //file_put_contents("wxpay_2.txt",$orderQueryResult['return_msg']); //file_put_contents("ccc.txt","通信出错:".$orderQueryResult['return_msg']."\n",FILE_APPEND); } elseif ($orderQueryResult["result_code"] == "FAIL") { //file_put_contents("wxpay_3.txt","qweqwe"); echo "错误代码:" . $orderQueryResult['err_code'] . "<br>"; echo "错误代码描述:" . $orderQueryResult['err_code_des'] . "<br>"; //file_put_contents("ccc.txt","错误代码:".$orderQueryResult['err_code']."\n",FILE_APPEND); //file_put_contents("ccc.txt","错误代码描述:".$orderQueryResult['err_code_des']."\n",FILE_APPEND); } else { file_put_contents("hhyds.txt", "111"); //file_put_contents("ccc.txt","交易状态:".$orderQueryResult['trade_state']."\n",FILE_APPEND); $total_fee_t = $orderQueryResult['total_fee'] / 100; $out_trade_no = $orderQueryResult['out_trade_no']; $this->db->Autocommit_start(); $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `money` = '{$total_fee_t}' and `status` = '未付款' for update"); if (!$dingdaninfo) { echo "fail"; exit; } $time = time(); $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '微信支付', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'"); $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$total_fee_t} where (`uid` = '{$dingdaninfo['uid']}')"); $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$dingdaninfo['uid']}', '1', '账户', '充值', '{$total_fee_t}', '{$time}')"); //file_put_contents("wxpay_2.txt",$up_q3); if ($up_q1 && $up_q2 && $up_q3) { //file_put_contents("momo.txt","yes"); $this->db->Autocommit_commit(); } else { //file_put_contents("momo.txt","no"); $this->db->Autocommit_rollback(); echo "fail"; exit; } if (empty($dingdaninfo['scookies'])) { echo "success"; exit; } $uid = $dingdaninfo['uid']; $scookies = unserialize($dingdaninfo['scookies']); $pay = System::load_app_class('pay', 'pay'); $pay->scookie = $scookies; $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record'); //闪购商品 if ($ok != 'ok') { _setcookie('Cartlist', NULL); echo "fail"; exit; //商品购买失败 } $check = $pay->go_pay(1); if ($check) { $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'"); _setcookie('Cartlist', NULL); echo "success"; exit; } else { echo "fail"; exit; } //------------------------------ //处理业务完毕 //------------------------------ //log_result("即时到帐后台回调成功"); } } }
$_clean = array(); $_clean['username'] = _check_username($_POST['username'], 2, 20); $_clean['password'] = _check_password($_POST['password'], 6); $_clean['time'] = _check_time($_POST['time']); //print_r($_clean); //到数据库验证 //用户名密码正确,且已经激活了账户的 if (!!($_rows = _fetch_array("select tg_username,tg_uniqid,tg_level from tg_user where tg_username='******'username']}' and tg_password='******'password']}' and tg_active='' limit 1"))) { //登录成功后,记录登录信息 //首先获取本机名 $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //通过本机名获取Ip $ip = gethostbyname("{$hostname}"); _query("update tg_user set \n\t\t\t\t\t\t\t\t\t\ttg_last_time=NOW(),\n\t\t\t\t\t\t\t\t\t\ttg_last_ip='{$ip}',\n\t\t\t\t\t\t\t\t\t\ttg_login_count=tg_login_count+1\n\t\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\t\ttg_username='******'tg_username']}'\n\t\t\t\t\t\t\t\t\t"); //_session_destroy(); //清楚验证码的session _setcookie($_rows['tg_username'], $_rows['tg_uniqid'], $_clean['time']); if ($_rows['tg_level'] == 1) { $_SESSION['admin'] = $_rows['tg_username']; } _close(); _location(null, 'member.php'); } else { _close(); //_session_destroy(); //清楚验证码的session _location('用户名密码不正确或者该账户未被激活', 'login.php'); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
function synlogout($get, $post) { if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } include "../../plus/config.php"; if ($config[sy_onedomain] != "") { $weburl = str_replace("http://www", "", $config[sy_onedomain]); } elseif ($config[sy_indexdomain] != "") { $weburl = str_replace("http://www", "", $config[sy_indexdomain]); } else { $weburl = str_replace("http://www", "", $config[sy_weburl]); } if ($config[sy_uc_type] == "uc_center") { $this->unset_cookie($weburl); } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); _setcookie('Example_auth', '', -86400 * 365); }
private function yeepay_chuli() { $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'yeepay' and `pay_start` = '1'"); $out_trade_no = $this->out_trade_no; $this->db->Autocommit_start(); $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' for update"); if (!$dingdaninfo) { return false; } //没有该订单,失败 if ($dingdaninfo['status'] == '已付款') { return '已付款'; } $c_money = intval($dingdaninfo['money']); $uid = $dingdaninfo['uid']; $time = time(); $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '易宝支付', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'"); $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')"); $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')"); if ($up_q1 && $up_q2 && $up_q3) { $this->db->Autocommit_commit(); } else { $this->db->Autocommit_rollback(); return '充值失败'; } if (empty($dingdaninfo['scookies'])) { return "充值完成"; //充值完成 } $scookies = unserialize($dingdaninfo['scookies']); $pay = System::load_app_class('pay', 'pay'); $pay->scookie = $scookies; $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record'); //闪购商品 if ($ok != 'ok') { $_COOKIE['Cartlist'] = ''; _setcookie('Cartlist', NULL); return '商品购买失败'; //商品购买失败 } $check = $pay->go_pay(1); if ($check) { $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'"); $_COOKIE['Cartlist'] = ''; _setcookie('Cartlist', NULL); return "商品购买成功"; } else { return '商品购买失败'; } }
function wx_callback() { session_start(); if ($_GET["state"] != $_SESSION["wxState"]) { _messagemobile("登录验证失败!", "" . $wx_set['back'] . "/?/mobile/user/login"); } $this->db = System::load_sys_class('model'); $wx_set = $this->db->GetOne("SELECT * from `@#_wxset` "); $code = $_GET["code"]; $procode = $this->segment(4); file_put_contents('t.txt', "\n\r\r\n-----procode:" . $procode, FILE_APPEND); $response = file_get_contents("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $wx_set['appid'] . "&secret=" . $wx_set['secret'] . "&code={$code}&grant_type=authorization_code"); $jsondecode = json_decode($response, true); $wx_openid = $jsondecode["openid"]; if (empty($wx_openid)) { _messagemobile("绑定出错,请联系管理员。"); die; } $access_token = $jsondecode["access_token"]; $response = file_get_contents("https://api.weixin.qq.com/sns/userinfo?access_token={$access_token}&openid={$wx_openid}"); $jsondecode = json_decode($response, true); $nickname = $jsondecode["nickname"]; $go_user_info = $this->db->GetOne("select * from `@#_member_band` where `b_code` = '{$wx_openid}' and `b_type` = 'weixin' LIMIT 1"); if (!$go_user_info) { $userpass = md5("123456"); $go_user_img = 'photo/member.jpg'; $go_user_time = time(); $q1 = $this->db->Query("INSERT INTO `@#_member` (`username`,`password`,`img`,`band`,`time`,`money`,`first`,code) VALUES ('{$nickname}','{$userpass}','{$go_user_img}','weixin','{$go_user_time}',0,1,'{$procode}')"); $uid = $this->db->insert_id(); $this->db->Query("INSERT INTO `@#_member_band` (`b_uid`, `b_type`, `b_code`, `b_time`) VALUES ('{$uid}', 'weixin', '{$wx_openid}', '{$go_user_time}')"); $member = $this->db->GetOne("select uid,password,mobile,email from `@#_member` where `uid` = '{$uid}' LIMIT 1"); $se1 = _setcookie("uid", _encrypt($member['uid']), 60 * 60 * 24 * 7); $se2 = _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email'])), 60 * 60 * 24 * 7); $callback_url = WEB_PATH . "/mobile/home/mobilebind"; header("Location:{$callback_url}"); } else { $uid = $go_user_info["b_uid"]; $member = $this->db->GetOne("select uid,password,mobile,email from `@#_member` where `uid` = '{$uid}' LIMIT 1"); $se1 = _setcookie("uid", _encrypt($member['uid']), 60 * 60 * 24 * 7); $se2 = _setcookie("ushell", _encrypt(md5($member['uid'] . $member['password'] . $member['mobile'] . $member['email'])), 60 * 60 * 24 * 7); if (!$member['mobile']) { $callback_url = WEB_PATH . "/mobile/home/mobilebind"; header("Location:{$callback_url}"); } else { $callback_url = WEB_PATH . "/mobile/activity/"; header("Location:{$callback_url}"); } } }
public function houtai() { $pay_type = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'ecpss' and `pay_start` = '1'"); $pay_type_key = unserialize($pay_type['pay_key']); $MD5key = $pay_type_key['key']['val']; //订单号 $BillNo = $out_trade_no = $_POST["BillNo"]; //金额 $Amount = $_POST["Amount"]; //支付状态 $Succeed = $_POST["Succeed"]; //支付结果 $Result = $_POST["Result"]; //取得的MD5校验信息 $MD5info = $_POST["MD5info"]; //校验源字符串 $md5src = $BillNo . $Amount . $Succeed . $MD5key; //MD5检验结果 $md5sign = strtoupper(md5($md5src)); if ($MD5info == $md5sign) { if ($Succeed == 88) { $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `status` = '未付款'"); if (!$dingdaninfo) { echo "fail"; exit; } //没有该订单,失败 $c_money = intval($dingdaninfo['money']); $uid = $dingdaninfo['uid']; $time = time(); $this->db->Autocommit_start(); $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '汇潮支付', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'"); $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')"); $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')"); if ($up_q1 && $up_q2 && $up_q3) { $this->db->Autocommit_commit(); } else { $this->db->Autocommit_rollback(); echo "fail"; exit; } if (empty($dingdaninfo['scookies'])) { echo "success"; exit; //充值完成 } $scookies = unserialize($dingdaninfo['scookies']); $pay = System::load_app_class('pay', 'pay'); $pay->scookie = $scookies; $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record'); //V购商品 if ($ok != 'ok') { _setcookie('Cartlist', NULL); echo "fail"; exit; //商品购买失败 } $check = $pay->go_pay(1); if ($check) { $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'"); _setcookie('Cartlist', NULL); echo "ok"; exit; } else { echo "fail"; exit; } } } else { echo "交易信息被篡改"; } }
public function houtai() { //导入公钥文件 $flag = buildKey(PUB_KEY); if (!$flag) { echo "导入公钥文件失败!"; exit; } //获取交易应答的各项值 $merid = $_REQUEST["merid"]; $orderno = $_REQUEST["orderno"]; $transdate = $_REQUEST["transdate"]; $amount = $_REQUEST["amount"]; $currencycode = $_REQUEST["currencycode"]; $transtype = $_REQUEST["transtype"]; $status = $_REQUEST["status"]; $checkvalue = $_REQUEST["checkvalue"]; $gateId = $_REQUEST["GateId"]; $priv1 = $_REQUEST["Priv1"]; $flag = verifyTransResponse($merid, $orderno, $amount, $currencycode, $transdate, $transtype, $status, $checkvalue); if (!flag) { echo "<h2>验证签名失败!</h2>"; exit; } // file_put_contents(dirname(__FILE__).DIRECTORY_SEPARATOR.'aa.txt', serialize($status)); $out_trade_no = $orderno; //商户订单号 if ($status == '1001') { $dingdaninfo = $this->db->GetOne("select * from `@#_member_addmoney_record` where `code` = '{$out_trade_no}' and `status` = '未付款'"); if (!$dingdaninfo) { echo "fail"; exit; } //没有该订单,失败 $c_money = intval($dingdaninfo['money']); $uid = $dingdaninfo['uid']; $time = time(); $this->db->Autocommit_start(); $up_q1 = $this->db->Query("UPDATE `@#_member_addmoney_record` SET `pay_type` = '支付宝', `status` = '已付款' where `id` = '{$dingdaninfo['id']}' and `code` = '{$dingdaninfo['code']}'"); $up_q2 = $this->db->Query("UPDATE `@#_member` SET `money` = `money` + {$c_money} where (`uid` = '{$uid}')"); $up_q3 = $this->db->Query("INSERT INTO `@#_member_account` (`uid`, `type`, `pay`, `content`, `money`, `time`) VALUES ('{$uid}', '1', '账户', '充值', '{$c_money}', '{$time}')"); if ($up_q1 && $up_q2 && $up_q3) { $this->db->Autocommit_commit(); } else { $this->db->Autocommit_rollback(); echo "fail"; exit; } if (empty($dingdaninfo['scookies'])) { echo "success"; exit; //充值完成 } $scookies = unserialize($dingdaninfo['scookies']); $pay = System::load_app_class('pay', 'pay'); $pay->scookie = $scookies; // var_dump($pay_type['pay_id']); // die(); $ok = $pay->init($uid, $pay_type['pay_id'], 'go_record'); //云购商品 if ($ok != 'ok') { _setcookie('Cartlist', NULL); echo "fail"; exit; //商品购买失败 } $check = $pay->go_pay(1); if ($check) { $this->db->Query("UPDATE `@#_member_addmoney_record` SET `scookies` = '1' where `code` = '{$out_trade_no}' and `status` = '已付款'"); _setcookie('Cartlist', NULL); echo "success"; exit; } else { echo "fail"; exit; } } }
public function out() { _setcookie("AID", ''); _setcookie("ASHELL", ''); _message("退出成功", G_MODULE_PATH . '/user/login'); }
function synlogout($get, $post) { if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } $uid = (int) $_COOKIE[SITE_PREFIX . 'member_uid']; //note 同步登出 API 接口 header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); _setcookie('member_uid', '', -86400 * 365); _setcookie('member_cookie', '', -86400 * 365); if ($uid) { $this->db->query('delete from ' . $this->tablepre . 'member_session where uid=' . $uid); } }