本文整理汇总了PHP中_setcookie函数的典型用法代码示例。如果您正苦于以下问题:PHP _setcookie函数的具体用法?PHP _setcookie怎么用?PHP _setcookie使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_setcookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: image
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();
}
示例2: cook_end
public function cook_end()
{
_setcookie("uid", "", time() - 3600);
_setcookie("ushell", "", time() - 3600);
header("Location:" . WEB_PATH);
// _message(WEB_PATH);
}
示例3: cook_end
public function cook_end()
{
_setcookie("uid", "", time() - 3600);
_setcookie("ushell", "", time() - 3600);
//_message("退出成功",WEB_PATH."/mobile/mobile/");
header("location: " . WEB_PATH . "/mobile/mobile/");
}
示例4: login
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");
}
示例5: image
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();
}
示例6: mobileregsn
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);
}
示例7: houtai
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;
}
}
//开始处理订单结束
}
示例8: findmobilecheck
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");
}
示例9: array_map
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
*
示例10: server
<?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/");
示例11: synlogout
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);
}
示例12: qq_set_member
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);
}
}
示例13: jf_paysuccess
public function jf_paysuccess()
{
$_COOKIE['Cartlist_jf'] = NULL;
_setcookie("Cartlist_jf", null);
include templates("cart", "jf_paysuccess");
}
示例14: mobilecheck
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");
}
示例15: houtai
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;
//.........这里部分代码省略.........