managing web site data

Post on 02-Jan-2016

33 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Managing Web Site Data. CS 320. Web Site Data. How do computer programs store data? Main memory: volatile Disk: permanent By definition, Web pages are stateless and do not store data. Browser Session. Begins when the user opens the browser and connects to a site - PowerPoint PPT Presentation

TRANSCRIPT

Managing Web Site Data

CS 320

Web Site Data

How do computer programs store data?Main memory: volatileDisk: permanent

By definition, Web pages are stateless and do not store data

Browser Session Begins when the user opens the browser and

connects to a site Ends when the user navigates to a new page or

closes the browser All input data is lost...

What kind of data might you want to store across pages during a single visit to a Web site?

What kind of data might you want to store across multiple visits to the same Web site?

Between Web pages in the same visit: Session variables Temporary cookies

Across multiple visits to a site: Persistent cookies Databases

Approaches for Storing Web Page Data

Specific Topics

Session variables Cookies Databases

Session Variables

When you request a Web page, the Web server creates a session object corresponding to your browser sessionThis information is stored in the Web server's

main memory Sessions have attributes that you can

retrieve and display using program commands

Session Variables

A program running on the Web server

can create session variables that store data values associated with a specific browser sessionValues are stored in Web server RAM and

associated with the session object

Session Timeout Intervals

By default, server/browser sessions "time out" (close) after a specific period of inactivity: Microsoft IIS: 20 minutes Tomcat: 30 minutes You can change these values to longer/shorter ones

At that point, the session closes and the session object is destroyed All session variable data is lost!

Limitations of Session Variables

Usually have a limited size Often limited to a maximum size of 300

characters Values are lost when the session ends or

times out

Specific Topics

Session variables Cookies Databases

What is a Cookie? Data item stored on the client workstation Can (theoretically) be read/modified only by Web

pages associated with the same Web server domain that originally created it

Cookie types: Temporary (session): only lasts during the current

session Stored in client (browser) RAM Can be read only in current browser session

Persistent: stores data in the client file system that is available across multiple browser sessions

Cookie Data Structure

Name/value pairs:

cookie_name=cookie_value

Example:

currUsername="morrisjp"

Cookie Options

Client-sideCreated using JavaScript

Server-sideCreated using a server-side program

Limitations of Cookies

Typically, browsers have limits on persistent cookies:Maximum of 20 cookies per Web siteMaximum of 300 cookies totalEach cookie can store a maximum of 4 KB of

data...

More Limitations of Cookies Stored locally

If you use multiple computers, you will have different sets of cookies

Possibility of: Information theft Cookie poisoning

Other Web sites change cookie contents

Profiling Marketers create cookies that are shared among sites

Users can disable cookies in their browser

Specific Topics

Session variables Cookies Databases

What is a database? Program for storing data

Structures data in a tabular formatMaintains relationships among data items

Example: customers make reservations

Has built-in programs to perform the basic data handling tasks

Insert, update, delete, retrieve

Has built-in features for managing multiple users, security, backups, etc.

Web/Database Architecture

DataBase

Client workstations

Browser

Browser

Browser

Database server

Server-SidePrograms

Web server(s)

Network

Network

Programs that:• Form queries based on user inputs• Display retrieved data• Insert/update/delete user data

Commonly-used:•mySQL•Access•SQL Server•Oracle

When does a Web site need a database? When the site needs to collect and store

data from site usersUsernames/passwords for site accessProduct selection and shipping informationUser inputs that need to be visible to other

users

Test Yourself:For an Ecommerce Web site, what would you use to store a user's shipping information (name, address)?

a) Session variables

b) Temporary cookie

c) Persistent cookie

d) Database

e) None of the above

Test Yourself:For an Ecommerce Web site, what would you use to store a user's shipping information (name, address)?

a) Session variables

b) Temporary cookie

c) Persistent cookie

d) Database

e) None of the above

Test Yourself:For an Ecommerce Web site, what would you use to store a user's shopping cart contents?

a) Session variables

b) Temporary cookie

c) Persistent cookie

d) Database

e) None of the above

Test Yourself:For an Ecommerce Web site, what would you use to store a user's shopping cart contents?

a) Session variables

b) Temporary cookie

c) Persistent cookie

d) Database

e) None of the above

Test Yourself:For an Ecommerce Web site, what would you use to store a user's credit card information?

a. Session variables

b. Temporary cookie

c. Persistent cookie

d. Database

e. None of the above

Test Yourself:For an Ecommerce Web site, what would you use to store a user's credit card information?

a. Session variables

b. Temporary cookie

c. Persistent cookie

d. Database

e. None of the above

top related