php header('P3P: CP="CAO PSA OUR"'); 做?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5257983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does header('P3P: CP="CAO PSA OUR"'); do?
提问by wyman
What is header('P3P: CP="CAO PSA OUR"');
for?
是header('P3P: CP="CAO PSA OUR"');
为了什么?
How/why will it let this script work fine in IE?
如何/为什么让这个脚本在 IE 中正常工作?
session_start();
if (!session_is_registered(pre_myusername)) {
header("location:index.php");
exit();
}
回答by Gumbo
P3P is the Platform for Privacy Preferences.The value CP="CAO PSA OUR"
describes a compact policywith the tokens
P3P 是隐私偏好平台。该值CP="CAO PSA OUR"
描述了带有令牌的紧凑策略
contact and others(access information: What information is collected?)
Identified Contact Information and Other Identified Data: access is given to identified online and physical contact information as well as to certain other identified data.
pseudo-analysis(purpose information: What is the collected information used for?)
Pseudonymous Analysis: 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. For example, a marketer may wish to understand the interests of visitors to different portions of a Web site.
ours(receipient information: Who gets that collected information?)
Ourselves and/or entities acting as our agents or entities for whom we are acting as an agent: An agent in this instance is defined as a third party that processes data only on behalf of the service provider for the completion of the stated purposes. (e.g., the service provider and its printing bureau which prints address labels and does nothing further with the information.)
已识别的联系信息和其他已识别数据:可以访问已识别的在线和物理联系信息以及某些其他已识别数据。
假名分析:信息可用于创建或建立与假名标识符相关联的特定个人或计算机的记录,而无需将识别数据(例如姓名、地址、电话号码或电子邮件地址)与记录相关联。此档案将用于确定个人的习惯、兴趣或其他特征,以进行研究、分析和报告,但不会用于尝试识别特定个人。例如,营销人员可能希望了解网站不同部分的访问者的兴趣。
我们自己和/或作为我们代理的实体或我们作为代理的实体:在这种情况下,代理被定义为仅代表服务提供商处理数据以完成所述目的的第三方。(例如,打印地址标签但不进一步处理信息的服务提供商及其印刷局。)
回答by Lekensteyn
Gumbo has already explained what P3P is. Now, about your code, session_is_registered
is deprecated. You are using pre_myusername
as a constant. If it's not defined, PHP will assume a string, but relying on this behavior is discouraged. If you really intended to use constants, use uppercase for clarity. Note that a variable should be prefixed with a dollar ($
).
Gumbo 已经解释了 P3P 是什么。现在,关于您的代码,session_is_registered
已弃用。您正在pre_myusername
用作常量。如果未定义,PHP 将假定为字符串,但不鼓励依赖此行为。如果您真的打算使用常量,为了清楚起见,请使用大写。请注意,变量应以美元 ( $
)为前缀。
- Make sure that no content is sent before
session_start();
or the session cookie will not be sent. - Session variables are available from the
$_SESSION
array. isset()
can be used for checking the existence of a variable (array key in this case).
- 确保之前没有发送任何内容,
session_start();
否则不会发送会话 cookie。 - 会话变量可从
$_SESSION
数组中获得。 isset()
可用于检查变量的存在(在这种情况下是数组键)。
So, the actual code becomes:
因此,实际代码变为:
session_start();
if(!isset($_SESSION['pre_myusername'])){
header("Location: index.php");
exit();
}
For examples and documentation of the session functions, visit the PHP Manual.
有关会话函数的示例和文档,请访问PHP 手册。
回答by pelms
header('P3P: CP="CAO PSA OUR"')
sets a particular P3PCompact Policy (CP) which has been commonly used to allow third-party cookies from (i)frames to be used in Internet Explorer.
header('P3P: CP="CAO PSA OUR"')
设置特定的P3P紧凑策略 (CP),该策略通常用于允许 (i) 框架中的第三方 cookie 在 Internet Explorer 中使用。
From Microsoft Knowledge Base article 323752.
Internet Explorer 6 introduced support for the Platform for Privacy Preferences (P3P) Project. The P3P standard notes that if a FRAMESET or a parent window references another site inside a FRAME or inside a child window, the child site is considered third party content. Internet Explorer, which uses the default privacy setting of Medium, silently rejects cookies sent from third party sites.
Internet Explorer 6 引入了对隐私首选项平台 (P3P) 项目的支持。P3P 标准指出,如果 FRAMESET 或父窗口引用 FRAME 内或子窗口内的另一个站点,则子站点被视为第三方内容。Internet Explorer 使用 Medium 的默认隐私设置,默默地拒绝从第三方站点发送的 cookie。
The article describes the CP code above:
文章描述了上面的CP代码:
This code sample shows that your site provides you access to your own contact information (CAO), that any analyzed data is only "pseudo-analyzed", which means that the data is connected to your online persona and not to your physical identity (PSA), and that your data is not supplied to any outside agencies for those agencies to use (OUR).
此代码示例显示,您的站点为您提供了对自己的联系信息 (CAO) 的访问权限,任何分析的数据都只是“伪分析”,这意味着数据与您的在线角色有关,而不是与您的物理身份 (PSA) ),并且您的数据不会提供给任何外部机构供这些机构使用 (OUR)。
N.B.This CP is invalid as it stands since it doesn't contain any RETENTIONor CATEGORIEStokens.
注意这个 CP 是无效的,因为它不包含任何RETENTION或CATEGORIES令牌。