简体   繁体   English

标题是什么('P3P:CP =“CAO PSA OUR”');做?

[英]What does header('P3P: CP=“CAO PSA OUR”'); do?

What is header('P3P: CP="CAO PSA OUR"'); 什么是header('P3P: CP="CAO PSA OUR"'); for? 对于?

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();
}

P3P is the Platform for Privacy Preferences. P3P是隐私首选项的平台。 The value CP="CAO PSA OUR" describes a compact policy with the tokens 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. 作为我们作为代理人的代理人或实体的我们自己和/或实体 :在这种情况下,代理人被定义为仅代表服务提供商处理数据以完成所述目的的第三方。 (eg, the service provider and its printing bureau which prints address labels and does nothing further with the information.) (例如,服务提供商及其印刷局打印地址标签,不再对信息做任何进一步的处理。)

Gumbo has already explained what P3P is. Gumbo已经解释了P3P是什么。 Now, about your code, session_is_registered is deprecated. 现在,关于您的代码,不推荐使用session_is_registered You are using pre_myusername as a constant. 您使用pre_myusername作为常量。 If it's not defined, PHP will assume a string, but relying on this behavior is discouraged. 如果没有定义,PHP将假定一个字符串,但不鼓励依赖此行为。 If you really intended to use constants, use uppercase for clarity. 如果您真的打算使用常量,请使用大写字母以保持清晰。 Note that a variable should be prefixed with a dollar ( $ ). 请注意,变量应以美元( $ )为前缀。

  • Make sure that no content is sent before session_start(); 确保在session_start();之前没有发送任何内容session_start(); or the session cookie will not be sent. 或者不会发送会话cookie。
  • Session variables are available from the $_SESSION array. 会话变量可从$_SESSION数组中获得。
  • isset() can be used for checking the existence of a variable (array key in this case). 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手册

header('P3P: CP="CAO PSA OUR"') sets a particular P3P Compact 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 . 来自Microsoft知识库文章323752

Internet Explorer 6 introduced support for the Platform for Privacy Preferences (P3P) Project. Internet Explorer 6引入了对隐私首选项平台(P3P)项目的支持。 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. P3P标准指出,如果FRAMESET或父窗口引用FRAME内或子窗口内的另一个站点,则子站点被视为第三方内容。 Internet Explorer, which uses the default privacy setting of Medium, silently rejects cookies sent from third party sites. 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)。

NB This CP is invalid as it stands since it doesn't contain any RETENTION or CATEGORIES tokens. 注意此CP 因其不包含任何RETENTIONCATEGORIES令牌而无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM