managing web site data
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 PresentationTRANSCRIPT
![Page 1: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/1.jpg)
Managing Web Site Data
CS 320
![Page 2: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/2.jpg)
Web Site Data
How do computer programs store data?Main memory: volatileDisk: permanent
By definition, Web pages are stateless and do not store data
![Page 3: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/3.jpg)
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?
![Page 4: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/4.jpg)
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
![Page 5: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/5.jpg)
Specific Topics
Session variables Cookies Databases
![Page 6: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/6.jpg)
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
![Page 7: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/7.jpg)
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
![Page 8: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/8.jpg)
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!
![Page 9: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/9.jpg)
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
![Page 10: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/10.jpg)
Specific Topics
Session variables Cookies Databases
![Page 11: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/11.jpg)
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
![Page 12: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/12.jpg)
Cookie Data Structure
Name/value pairs:
cookie_name=cookie_value
Example:
currUsername="morrisjp"
![Page 13: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/13.jpg)
Cookie Options
Client-sideCreated using JavaScript
Server-sideCreated using a server-side program
![Page 14: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/14.jpg)
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...
![Page 15: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/15.jpg)
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
![Page 16: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/16.jpg)
Specific Topics
Session variables Cookies Databases
![Page 17: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/17.jpg)
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.
![Page 18: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/18.jpg)
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
![Page 19: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/19.jpg)
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
![Page 20: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/20.jpg)
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
![Page 21: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/21.jpg)
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
![Page 22: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/22.jpg)
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
![Page 23: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/23.jpg)
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
![Page 24: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/24.jpg)
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
![Page 25: Managing Web Site Data](https://reader035.vdocuments.us/reader035/viewer/2022062308/5681339c550346895d9aae22/html5/thumbnails/25.jpg)
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