php使用p3p实现cookies跨域设置 实现单点登录,全站登录
P3P Header is present:
CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Compact Policy token is present. A trailing 'o' means opt-out, a trailing 'i' means opt-in. CURa
Information is used to complete the activity for which it was provided. ADMa
Information may be used for the technical support of the Web site and its computer system. DEVa
Information may be used to enhance, evaluate, or otherwise review the site, service, product, or market. PSAo
Information may be used to create or build a record of a particular individual or computer that is tied to a pseudonymous identifier, without tying identified data (such as name, address, phone number, or email address) to the record. This profile will be used to determine the habits, interests, or other characteristics of individuals for purpose of research, analysis and reporting, but it will not be used to attempt to identify specific individuals. PSDo
Information may be used to create or build a record of a particular individual or computer that is tied to a pseudonymous identifier, without tying identified data (such as name, address, phone number, or email address) to the record. This profile will be used to determine the habits, interests, or other characteristics of individuals to make a decision that directly affects that individual, but it will not be used to attempt to identify specific individuals. OUR
We share information with ourselves and/or entities acting as our agents or entities for whom we are acting as an agent. BUS
Info is retained under a service provider's stated business practices. Sites MUST have a retention policy that establishes a destruction time table. The retention policy MUST be included in or linked from the site's human-readable privacy policy. UNI
Non-financial identifiers, excluding government-issued identifiers, issued for purposes of consistently identifying or recognizing the individual. These include identifiers issued by a Web site or service. PUR
Information actively generated by the purchase of a product or service, including information about the method of payment. INT
Data actively generated from or reflecting explicit interactions with a service provider through its site -- such as queries to a search engine, or logs of account activity. DEM
Data about an individual's characteristics -- such as gender, age, and income. STA
Mechanisms for maintaining a stateful session with a user or automatically recognizing users who have visited a particular site or accessed particular content previously -- such as HTTP cookies. PRE
Data about an individual's likes and dislikes -- such as favorite color or musical tastes. COM
Information about the computer system that the individual is using to access the network -- such as the IP number, domain name, browser type or operating system. NAV
Data passively generated by browsing the Web site -- such as which pages are visited, and how long users stay on each page. OTC
Other types of data not captured by the above definitions. NOI
Web Site does not collected identified data. DSP
The privacy policy contains DISPUTES elements. COR
Errors or wrongful actions arising in connection with the privacy policy will be remedied by the service.
原理,
对于IE来说(默认安全级别下),iframe、img、link等标签都是只发送session cookie(又叫 第一方cookie),拦截本地cookie发送(又叫第三方cookie)。当这些标签跨域引用一个页面,实际上是发起了一次GET请求。
如果这个跨域的请求,HTTP返回头中带有Set-Cookie , 那么这个cookie对浏览器来说,实际上是无效的。
www.b.com p3p.php代码内容
/*
* chrome,firefox不加header都行,ie因为有cookie安全限制,所以就必须加header
* 可以使用一个吧账号和密码加密的处理成一个字符串传过去,然后去其他子站点处理字符串然后解析成账号密码登陆
* 加密方法一定是可以逆行解的,不然就蛋疼了,使用http://php.net/manual/zh/book.mcrypt.php这个函数,或者自己写其他的方法
*
* JS的提交方法,ajax也可以使用
*
* xmlhttp.setRequestHeader( "P3P" , 'CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"' );
*/ $password = 'zzzzzzzzzzzzzzz'; echo "<script src='http://www.a.com/cookie.php?password=$password'></script>";
www.a.com cookies代码内容
<?php
session_start();
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
setcookie("zx", $_GET['password'], time()+3600, "/");
www.a.com index.php的代码内容、
<?php var_dump($_COOKIE);
php使用p3p实现cookies跨域设置 实现单点登录,全站登录的更多相关文章
- 通过P3P头实现跨域设置cookie
PHP的setcookie函数可以设置域,但是只能在当前域内,如果出现多域可由如下办法处理:实现原理:www.b.com/set_cookie.php 在b域名下设置a域名的cookie < ...
- chrome浏览器的跨域设置——包括版本49前后两种设置
做前后分离的webapp开发的时候,出于一些原因往往需要将浏览器设置成支持跨域的模式,好在chrome浏览器就是支持可跨域的设置,网上也有很多chrome跨域设置教程.但是新版本的chrome浏览器提 ...
- vue-cli的跨域设置
概述 今天打算快速使用vue-cli建立一个小应用用于测试,使用axios发送http请求,但是遇到了跨域问题,总结了一下,供以后开发时参考,相信对其他人也有用. vue-cli的跨域设置 在vue. ...
- WebApi服务以及跨域设置
WCF 它利用TCP.HTTP.MSMQ等传输协议构建“契约先行”的服务.WCF最初为基于SOAP的服务而设计[xml],繁琐.冗余.慢.沉重 WebApi 基于http协议,轻量级的,支持URL路由 ...
- Mac下的Chrome或Safari访问跨域设置,MBP上使用模拟器Simulator.app或iphone+Safari调试网页
Mac下的Chrome或Safari访问跨域设置: mac下终端启动Chrome $ open -a Google\ Chrome --args --disable-web-security 或 /A ...
- Asp.net core 跨域设置
验证环境: dotnet core 2.1/Asp.net core2.1 一.作用域在中间件层 配置的方式是在startup.cs文件Configure(IApplicationBuilder a ...
- chrome浏览器的跨域设置 Google Chrome浏览器下开启禁用缓存和js跨域限制--disable-web-security
chrome用户默认路径 Win7:C:\Users\[用户名]\AppData\Local\Google\Chrome\User Data\XP:C:\Documents and Settings\ ...
- jexus手动跨域设置
AP.NET MVC默认跨域方法如下: <system.webServer> <validation validateIntegratedModeConfiguration=&quo ...
- SSO单点登录、跨域重定向、跨域设置Cookie、京东单点登录实例分析
最近在研究SSO单点登录技术,其中有一种就是通过js的跨域设置cookie来达到单点登录目的的,下面就已京东商城为例来解释下跨域设置cookie的过程 涉及的关键知识点: 1.jquery ajax跨 ...
随机推荐
- zookeeper + LevelDB + ActiveMQ实现消息队列高可用
通过集群实现消息队列高可用. 消息队列在项目中存储订单.邮件通知.数据分发等重要信息,故对消息队列稳定可用性有高要求. 现在通过zookeeper选取activemq leader的形式实现当某个ac ...
- js-新兴的API,最佳实践,离线应用于客户端存储
离线应用于客户端存储: 1.离线检测:online以及offline事件,都是在window对象上触发 navigator.online为true的时候是表示设备能够上网 2.使用一个描述文件(man ...
- 去除手机端a标签等按下去背景色
a,button,input,textarea,label,i,em{/*highlight*/ -webkit-tap-highlight-color: rgba(255,0,0,0); borde ...
- hdu 5459 Jesus Is Here (费波纳茨递推)
Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission ...
- jquery(ajax)与js(ajax)的比较
原始js: function update_mess(){ var account_name = $("#account").val(); var xmlhttp; if(wind ...
- 我的c++学习(5)switch语句详解
#include "stdafx.h" #include<iostream> using namespace std; #include<iomanip> ...
- NOIP201103瑞士轮【B002】
[B002]瑞士轮[B级]出自附中OJ————————————————————————————————————————————————————————————————————————————————— ...
- iOS Xcode个人常用插件
1.AdjustFontSize 按command +/-进行字体大小调整 2.ATProperty @property专用,strong.assign.copy.weak IBOutlet 3.Ba ...
- Shell 编程基础之 Break, Continue 练习
一.语法 break:用来跳出循环.break N 可以跳出多层循环 break break N continue:用来跳过循环.continue N 可以跳过多层循环 continue contin ...
- Shell 编程基础之注意技巧
退出状态bash中的内建命令虽然不创建新的进程,但也会有Exit Status,通常也用0表示成功非零表示失败,可以用特殊变量$?读出 命令代换:`或$() user@ae01:~$ echo `da ...