06 July 2013

PHP eBook

O'reilly -PHP Cookbook - Examples And Solutions

Web programming is probably why you’re reading this book. It’s why the first version
of PHP was written and what continues to make it so popular today. PHP makes
it easy to write dynamic web programs that do almost anything. Other chapters
cover various PHP capabilities, like graphics, regular expressions, database access,
and file I/O. These capabilities are all part of web programming, but this chapter
focuses on some web-specific concepts and organizational topics that will make your
web programming stronger.
Recipes 8.1, 8.2, and 8.3 show how to set, read, and delete cookies. A cookie is a
small text string that the server instructs the browser to send along with requests the
browser makes. Normally, HTTP requests aren’t “stateful”; each request can’t be
connected to a previous one. A cookie, however, can link different requests to the
same user. This makes it easier to build features such as shopping carts or keep track
of a user’s search history.
Recipe 8.4 shows how to redirect users to a different web page than the one they
requested. Recipe 8.5 explains the session module, which lets you easily associate
persistent data with a user as he moves through your site. Recipe 8.6 demonstrates
how to store session information in a database, which increases the scalability and
flexibility of your web site. Discovering the features of a user’s browser is shown in
Recipe 8.7. Recipe 8.8 shows the details of constructing a URL that includes a GET
query string, including proper encoding of special characters and handling of HTML
entities.
The next two recipes demonstrate how to use authentication, which lets you protect
your web pages with passwords. PHP’s special features for dealing with HTTP Basic
authentication are explained in Recipe 8.9. Sometimes it’s a better idea to roll your

own authentication method using cookies, as shown in Recipe 8.10.
====Download====

No comments:

Post a Comment

Thank you for visit my website/blog