Prev | Current Page 512 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

However, limitations on cookie size and the number
of cookies allowed, and various inconveniences surrounding their implementation,
prompted developers to devise another solution: session handling.
Session handling is essentially a clever workaround to this problem of statelessness.
This is accomplished by assigning to each site visitor a unique identifying attribute,
known as the session ID (SID), and then correlating that SID with any number of
other pieces of data, be it number of monthly visits, favorite background color, or
middle name??”you name it. In relational database terms, you can think of the SID
as the primary key that ties all the other user attributes together. But how is the SID
continually correlated with the user, given the stateless behavior of HTTP? It can be
done in two different ways:
??? Cookies: One ingenious means for managing user information actually builds
upon the original method of using a cookie. When a user visits a Web site, the
server stores information about the user, such as their preferences, in a cookie
and sends it to the browser, which saves it. As the user executes a request for
another page, the server retrieves the user information and uses it, for example,
to personalize the page. However, rather than storing the user preferences in
the cookie, the SID is stored in the cookie. As the client navigates throughout
the site, the SID is retrieved when necessary, and the various items of data correlated
with that SID are furnished for use within the page.


Pages:
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524