Page 236 - Open Soource Technologies 304.indd
P. 236
Web Technologies-I
Notes 9.8 Summary
• PHP was designed as a web scripting language. Although it is possible to use it in purely
command-line and GUI scripts, the Web accounts for the vast majority of PHP uses.
• PHP creates a separate global variable for every form parameter, every piece of request
information, and every server configuration value. This functionality is convenient but
dangerous, as it lets the browser provide initial values for any of the variables in your
program.
• The Apache server also creates entries in the $_SERVER array for each HTTP header in
the request. For each key, the header name is converted to uppercase, hyphens (-) are
turned into underscores (_), and the string “HTTP_” is prepended.
• It is always a good idea to have a “blank” option as the first option in your select box. It
forces the user to make a conscious selection from the box and avoids a situation where
the user might skip over the box without meaning to.
• PHP treats hidden form fields just like normal form fields, so the values are available in
the $_GETand $_POST arrays. Using hidden form fields, you can pass around the entire
contents of a shopping cart.
• The best way to maintain state with PHP is to use the built-in session-tracking system.
This system lets you create persistent variables that are accessible from different pages of
your application, as well as in different visits to the site by the same user.
• PHP has built-in support for sessions, handling all the cookie manipulation for you to
provide persistent variables that are accessible from different pages and across multiple
visits to the site.
• You can change the location of the session files by setting the session.save_path value in
php.ini. If you are on a shared server with your own installation of PHP, set the directory
to somewhere in your own directory tree, so other users on the same machine cannot
access your session files.
• When you choose to activate SSL on your web server you will be prompted to complete
a number of questions about the identification of your website and your company. Your
web server then creates two cryptographic keys—a Private Key and a Public Key.
9.9 Keywords
Cookies: A cookie is basically a string that contains several fields. A server can send one or more
cookies to a browser in the headers of a response.
GET: This is a simple request for a document or resource residing at a specific URI (Uniform
Resource Indicator). It is the most common type of Web request.
HEAD: This is similar to a GET request, except that it is only looking for HTTP header information
on the resource, not the resource itself.
HTTP header: The HTTP header contains details about the transaction between the client and
server with slight variations, depending on whether it is a request or a response.
Hypertext Transfer Protocol (HTTP): It is the network protocol used to transmit Web content
over the Internet. It works with TCP/IP to transmit information. HTTP handles addressing the
package and providing information that allows the client and server to effectively communicate
over the Web.
230 LOVELY PROFESSIONAL UNIVERSITY