Macromedia dreamweaver 8-using dreamweaver User Manual
Accessing data stored in session variables
679
Related topics
■
■
■
■
Accessing data stored in session
variables
variables
Session variables provide a mechanism through which user information can be stored and
accessed for use by web applications. Typically, session variables store information (usually
form or URL parameters submitted by users) and make that information available to all of the
application’s pages for the duration of the user’s visit. For example, when users log on to a web
portal that provides access to e-mail, stock quotes, weather reports, and daily news, the web
application stores the login information in a session variable that identifies the user
throughout the site’s pages. This allows the user to see only the types of content they have
selected as they navigate through the site. Session variables can also provide a safety
mechanism in the form of a time-out that terminates the user’s session if the account remains
inactive for too long a period of time. This also frees server memory and processing resources
if the user forgets to log off a website.
accessed for use by web applications. Typically, session variables store information (usually
form or URL parameters submitted by users) and make that information available to all of the
application’s pages for the duration of the user’s visit. For example, when users log on to a web
portal that provides access to e-mail, stock quotes, weather reports, and daily news, the web
application stores the login information in a session variable that identifies the user
throughout the site’s pages. This allows the user to see only the types of content they have
selected as they navigate through the site. Session variables can also provide a safety
mechanism in the form of a time-out that terminates the user’s session if the account remains
inactive for too long a period of time. This also frees server memory and processing resources
if the user forgets to log off a website.
Session variables are commonly used to store user display preferences, answers to multipart
questionnaires, items chosen for purchase in so-called “shopping cart” applications, and
running score tallies for online games.
questionnaires, items chosen for purchase in so-called “shopping cart” applications, and
running score tallies for online games.
Understanding session variables
Web servers (or more specifically, the HTTP protocol) are stateless, meaning that they do not
keep track of the browsers connecting to them, or of the individual page requests by users.
Every time a web server receives a request for a web page and responds to it by delivering the
relevant page to the user’s browser, the web server “forgets” about both the browser making
the request and the web page it sent. When the same user requests a related page at a later
time, the web server sends the page without knowing the last page that it sent to that user.
keep track of the browsers connecting to them, or of the individual page requests by users.
Every time a web server receives a request for a web page and responds to it by delivering the
relevant page to the user’s browser, the web server “forgets” about both the browser making
the request and the web page it sent. When the same user requests a related page at a later
time, the web server sends the page without knowing the last page that it sent to that user.