Working with Cookies Managing Data in a Web Site Using JavaScript Cookies* *Check and comply with the current legislation regarding handling cookies.

Slides:



Advertisements
Similar presentations
LIS651 lecture 3 taming PHP Thomas Krichel
Advertisements

LIS651 lecture 3 functions & sessions Thomas Krichel
Session Variables Storing Session Variables on the Server.
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Cookies Purpose –Write information that lives after the browser exits –Keep track of form data submitted multiple times during a particular visit –Track.
6/10/2015Cookies1 What are Cookies? 6/10/2015Cookies2 How did they do that?
©2009 Justin C. Klein Keane PHP Code Auditing Session 7 Sessions and Cookies Justin C. Klein Keane
XP Tutorial 9 New Perspectives on JavaScript, Comprehensive1 Working with Cookies Managing Data in a Web Site Using JavaScript Cookies.
Chapter 10 Maintaining State Information Using Cookies.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Beginning Active Server Pages Barry Sosinsky Valda Hilley Programming.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Computer Concepts 2014 Chapter 7 The Web and .
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Cookies Set a cookie – setcookie() Extract data from a cookie - $_COOKIE Augment user authentication script with a cookie.
CHAPTER 12 COOKIES AND SESSIONS. INTRO HTTP is a stateless technology Each page rendered by a browser is unrelated to other pages – even if they are from.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
Cookies and Security Saving the “state”
JavaScript, Fourth Edition
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
CSE 154 LECTURE 12: COOKIES. Including files: include include("filename"); PHP include("header.html"); include("shared-code.php"); PHP inserts the entire.
Web Programming Language Week 7 Dr. Ken Cosh Security, Sessions & Cookies.
Creating Databases for Web Applications cookie examples lab time: favorites cookies & Sessions class time for group work/questions on projects Next class:
Chapter 8 Cookies And Security JavaScript, Third Edition.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
Regular Expression (continue) and Cookies. Quick Review What letter values would be included for the following variable, which will be used for validation.
1 Maryland ColdFusion User Group Session Management December 2001 Michael Schuler
Cookies Web Browser and Server use HTTP protocol to communicate and HTTP is a stateless protocol. But for a commercial website it is required to maintain.
1 Welcome to CSC 301 Web Programming Charles Frank.
11 1 Cookies CGI/Perl Programming By Diane Zak Objectives In this chapter, you will: Learn the difference between temporary and persistent cookies.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
STATE MANAGEMENT.  Web Applications are based on stateless HTTP protocol which does not retain any information about user requests  The concept of state.
PHP Programming with MySQL Slide 10-1 CHAPTER 10 Managing State Information.
7 Chapter Seven Client-side Scripts. 7 Chapter Objectives Create HTML forms Learn about client-side scripting languages Create a client-side script using.
COOKIES and SESSIONS. COOKIES A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each.
Web Database Programming Week 7 Session Management & Authentication.
A Little Bit About Cookies Fort Collins, CO Copyright © XTR Systems, LLC A Little Bit About Cookies Instructor: Joseph DiVerdi, Ph.D., M.B.A.
JavaScript Part 9 George Mason University June 23, 2010.
SE-2840 Dr. Mark L. Hornick1 Servlet Threads and Sessions.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
Persistence Maintaining state using cookies and queries.
Cookies (continue). Extracting Data From Cookies Data retrieved from a cookie is a simple text string. While there is no specific JavaScript function.
Cookies. Cookie A cookie is a method for a Web server to maintain state information about users as users navigate different pages on the site, and as.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Cookies / Sessions Week 10 TCNJ Web 2 Jean Chu. Webpages have no memories.
PHP and Sessions. Session – a general definition The GENERAL definition of a session in the “COMPUTER WORLD” is: The interactions (requests and responses)
IS2802 Introduction to Multimedia Applications for Business Lecture 8: JavaScript and Cookies Rob Gleasure
ITM © Port,Kazman 1 ITM 352 Cookies. ITM © Port,Kazman 2 Problem… r How do you identify a particular user when they visit your site (or any.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Project 5: Customizing User Content Essentials for Design JavaScript Level Two Michael Brooks.
ASP.NET Part II Dr. Awad Khalil Computer Science Department AUC.
Cookies and Sessions in PHP. Arguments for the setcookie() Function There are several arguments you can use i.e. setcookie(‘name’, ‘value’, expiration,
Sessions and cookies (part 2) MIS 3501, Fall 2015 Brad N Greenwood, PhD Department of MIS Fox School of Business Temple University 11/19/2015.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
1 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Programming for the Web Cookies & Sessions Dónal Mulligan BSc MA
National College of Science & Information Technology.
JavaScript, Sixth Edition
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
Sessions and cookies (part 2)
Cookies and Sessions in PHP
Cookies and JavaScript
What is Cookie? Cookie is small information stored in text file on user’s hard drive by web server. This information is later used by web browser to retrieve.
Client / Session Identification Cookies
Presentation transcript:

Working with Cookies Managing Data in a Web Site Using JavaScript Cookies* *Check and comply with the current legislation regarding handling cookies

Introducing Cookies Desired features of a Web site –Users should be able to Navigate product listing Purchase products Create accounts

Developing a Shopping Cart Application Back end –Mechanism that helps Web site function behind the scenes Front end –Visible part of a Web site

Developing a Shopping Cart Application Server-side shopping cart –Shopping cart application controlled via server Client-side shopping cart –Application controlled via user’s browser with JavaScript

Client-Side and Server-Side Shopping Cart Applications

Understanding Cookies Session –Each visit to a Web page by a user Cookie –Text file that stores data from a user’s interaction with a specific Web site –Persistent Stateless protocol –No way to track information

Understanding Cookies Client-side cookie –Initiated by a page coming from a Web server –Created in a browser’s memory Server-side cookie –Created and stored on a server using server-side scripting languages

Types of Cookies First-party cookie –Cookie created from the Web site you are visiting Third-party cookie* –Cookie created at different Web site and is then sent to Web site you are currently visiting * Check and comply with the current legislation regarding handling cookies

Customized Cookie Settings in Internet Explorer

Creating a Cookie Syntax document.cookie = "name = value; expires = expiration; path = path; domain = domain; secure";

Cookie Attributes

The name and value Properties Each cookie stores –Single piece of information as its value, which is paired with a name when cookie is created Dynamically generating parameters for cookie username = document.form1.uname.value; document.cookie = "input1 = "+username;

The expires Property Cookie –Can be assigned an expiration date To assign expiration date expires = Day, DD-Mmm-YY HH:MM:SS GMT Per session cookie –Exists only for as long as the browser is communicating with the Web site

The path Property By default –Cookie available only to page where it originated path attribute –Used to set the pages to which a cookie is available

The domain Property Used to specify –URL of domain to which you want to make cookie available If no value is specified for domain property –Its value is set to the server of origin

The secure Property The final property you can set for a cookie Enables you to specify that –Cookie is to be transmitted over the HTTPS protocol To set a cookie as a secure cookie –Add the parameter “secure” without a value

Populating Form Fields with Cookie Values Assigning value of user variable to username field function retrieveAccount() { document.login.username.value=user; }

Using Cookie Values to Create a Personalized Greeting Code to personalize the home page if((fn != "")&&(ln != "")){document.write("Hello, "+fn+" "+ln+". ")}

Deleting Cookies To control deletion of cookies –Set date and time you want cookie deleted –Develop function that deletes cookie when it is called