Page 181 - Open Soource Technologies 304.indd
P. 181

Open Source Technologies



                   Notes
                                   Now, you need to know how to implement the compact policy into your pages. Again, I’ll
                                   illustrate this point with the code I used for my own site.

                                   In pure HTML pages, insert this code into the head section of your page:

                                   <meta http-equiv=”P3P” content=’CP=”IDC DSP COR CURa ADMa OUR IND PHY ONL
                                   COM STA”’>

                                   In PHP pages, insert this as the first thing on the page after the setting of the cookie:
                                   <?php header(‘P3P: CP=”IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA”’); ?>

                                   For other server-side languages, see the link below titled “Header Creation”.

                                   Of course, don’t  just  use  the code  above as-is.  You  need  to go to the URL  given below
                                   at the Privacy Council, and generate your own. Don’t worry, it’s straightforward and
                                   non-technical.

                                   It’s important to understand that only pages that place cookies need to have a CP. Form
                                   pages don’t set cookies, so they don’t need a policy. Remember that if you use a piece of
                                   JavaScript code to set a cookie for popup control, the page that calls the popup and does the
                                   cookie- setting will require a compact policy.

                                   Some sites may need more than one policy. Why? Well, a policy describes what information
                                   is collected (and why)  in a  specific URL location.  That can  be the  whole site, or  specific
                                   folders on your site. While most of us will probably generate one policy for the whole site,
                                   it is possible to point to a different policy location in each header, on each page. You would
                                   do this if, for example, one section of your site allowed users to subscribe to your newsletter
                                   by providing their email addresses and first names, while the other offers a members’ area
                                   that uses cookies to customize the browser’s view. Perhaps you also provide a shopping cart
                                   that stores user status and personal information for use in processing the order.

                                   If you need to point to another policy that has been generated to describe a specific use of
                                   cookies like this, you’ll want to put one of the following headers on the page(s) that pass
                                   cookies to the visiting browser:

                                   Firstly, using PHP:
                                   <?php Header(‘P3P: href=”/your_2nd_policy/p3p.xml” CP=”your compact policy”’); ?>

                                   Now, using HTML:

                                   <meta http-equiv=”P3P” href=”/your_2nd_policy/p3p.xml” content=’CP=”your compact
                                   policy”’>


                                 10.6 Summary


                                    •  Cookies can be used for authentication, storing site preferences, shopping cart contents,
                                      the identifier for a server-based session, or anything else that can be accomplished through
                                      storing text data.

                                    •  Cookies can also be removed by the user at any time, so do not use them to stored anything
                                      too important.



        176                               LOVELY PROFESSIONAL UNIVERSITY
   176   177   178   179   180   181   182   183   184   185   186