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

Unit 10: Cookies



               •  Session state is usually stored in a temporary file, although you can implement database   Notes
                 storage using a function called session set save handler ().
               •  Destroying the session does not destroy the registered variable.

            10.7 Keywords


            Changing the Session Function Streams: The following figure summarizes the session functions
            and their attributes. You cannot specify an input stream for the message (MSG) function.
            Cookies: These are commonly used to rotate the banner ads that a site sends so that it doesn’t
            keep sending the same ad as it sends you a succession of requested pages.

            Deleting Cookies with PHP:  PHP, or Hypertext Preprocessor, is an open-source scripting
            language primarily used for web programming. Deleting a cookie is almost the same as setting
            one. To delete it, you use the same parameters that you used when you set the cookie, except
            for the value, which needs to be an empty string, and the expiry date, which needs to be set in
            the past. On our logout page, we delete the cookie its different way.
            Destroying Session and Unsetting Variables: Although a session’s data is temporary and does
            not require that you explicitly clean after yourself, you may wish to delete some data for your
            various tasks.
            Intensity (INT): It is refers to the brightness at which the information is displayed in a stream.

            Session Function Overview: Session functions implement a concept that you have already seen;
            that is, the provision to users of a unique identifier, which can then be used from access to access
            to acquire information linked to that ID.
            SESSIONS: Session Manager also has an input and output stream.

            Starting Session: A session is a combination of a server-side file containing all the data you
            wish to store, and a client-side cookie containing a reference to the server data. The file and the
            client- side cookie are created using the function session_start() - it has no parameters, but informs
            the server that sessions are going to be used.

            Working with Session Variables: Session variables are similar to cookies, that is they are used
            to store information for a particular period of time. The values in session variables exist only
            till the session exists.
                          1.   Write a program. If a variable that is PASSED BY REFERENCE is unset()
                             inside of a function, only the local variable is destroyed. The variable in the
                             calling environment will retain the same value as before unset() was called.
                          2.  Write a program.  If a globalized variable is unset() inside of a function,
                             only the local variable is destroyed.
                          3.  Draw figure that shows the way our scripts can be tied together.

            10.8 Self Assessment Questions

               1.  A cookie is a _______________ that allows the server to store its own information about
                 an user on the user’s own computer.




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