Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.

Slides:



Advertisements
Similar presentations
LIS651 lecture 3 taming PHP Thomas Krichel
Advertisements

LIS651 lecture 3 functions & sessions Thomas Krichel
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.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
Chapter 10 Managing State Information Using Sessions.
©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 Managing State Information PHP Programming with MySQL.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
Using Session Control in PHP tMyn1 Using Session Control in PHP HTTP is a stateless protocol, which means that the protocol has no built-in way of maintaining.
Chapter 10 Maintaining State Information Using Cookies.
Objectives Learn about state information
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
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.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
Tutorial 10 Adding Spry Elements and Database Functionality Dreamweaver CS3 Tutorial 101.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation.
JavaScript, Fourth Edition
Week Four CIT 354 Internet II. 2 Objectives Uploading Files to Your Web Site Establishing a Connection Creating a Database Table Common Programming Errors.
Working with Cookies Managing Data in a Web Site Using JavaScript Cookies* *Check and comply with the current legislation regarding handling cookies.
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.
Chapter 8 Cookies And Security JavaScript, Third Edition.
12/3/2012ISC329 Isabelle Bichindaritz1 PHP and MySQL Advanced Features.
PHP1-1 PHP Lecture 2 Xingquan (Hill) Zhu
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
1 Maryland ColdFusion User Group Session Management December 2001 Michael Schuler
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
Cookies & Session Web Technology
Dr. Azeddine Chikh IS444: Modern tools for applications development.
PHP Programming with MySQL Slide 10-1 CHAPTER 10 Managing State Information.
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.
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
Web Database Programming Week 7 Session Management & Authentication.
Cookies and Sessions IDIA 618 Fall 2014 Bridget M. Blodgett.
MEMBERSHIP AND IDENTITY Active server pages (ASP.NET) 1 Chapter-4.
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
Cookies COEN 351 E-commerce Security. Client / Session Identification HTTP Headers Client IP Address HTTP User Login FAT URLs Cookies.
Sessions and Cookies State Management, Cookies, Sessions, Hidden Fields SoftUni Team Technical Trainers Software University
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
PHP and Sessions. Session – a general definition The GENERAL definition of a session in the “COMPUTER WORLD” is: The interactions (requests and responses)
 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 time the same computer requests.
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.
Cookies and Sessions in PHP. Arguments for the setcookie() Function There are several arguments you can use i.e. setcookie(‘name’, ‘value’, expiration,
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
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.
Programming for the Web Cookies & Sessions Dónal Mulligan BSc MA
PHP – Hypertext Preprocessor.
© Copyright 2012 Hidaya Trust (Pakistan) ● A Non-Profit Organization ● / www,histpk.org Hidaya Institute of Science & Technology
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.
ITM 352 Cookies.
Client / Session Identification Cookies
Web Programming Language
Cookies and Sessions in PHP
Open Source Programming
Web Systems Development (CSC-215)
Client / Session Identification Cookies
<?php require("header.htm"); ?>
Web Programming Language
CSc 337 Lecture 27: Cookies.
Web Programming Language
PHP-II.
CSc 337 Lecture 25: Cookies.
Presentation transcript:

Week seven CIT 354 Internet II

2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2

3 Project 1 Presentation (Anyone?) Demonstration

4 Database_Driven User Authentication Create a database table for authorized users Create a login form and script sequence that authenticates users before displaying any secrets

5 Database_Driven User Authentication Why Authenticate Anyone? –You might want to restrict access to certain members of your development team. A common type of user authentication is database-driven, in which usernames and password are kept in a database table and accessed via a login form and script. Create the User table –Run show_createtable.html

6 Database_Driven User Authentication Adding Users to Your Table Examples:show_adduser.html (P 225) do_adduser.php ( P 227) Submitting your Form and Getting Results

7 Database_Driven User Authentication Creating the Login Form Example:show_login.html (P 231) Creating the Authentication Script Example:do_authuser.php Submitting your Form and Getting Results (Trying to Authenticate Yourself)

8 Using Cookies Set a Cookie Extract data from a cookie Amend your user authentication routines to use a cookie

9 Using Cookies What’s a Cookie? –Cookies are pieces of text that are sent to a user’s Web browser. Cookies can help to create shopping carts, user communities, and personalized sites. Cookie can be used to store an unique identification string that will match a user with data held securely in a database. Setting Cookies –You must set a cookie before sending any other content to the browser. –6 arguments (name, value, expiration, path, domain, security) –Example: setcookie(“id”, “55sds jjsj2”, time()+14400, “/”, “.yourdoamin.com”, 0) –Counting Time (Table 16.1)

10 Using Cookies Setting a test Cookie Example:setcookie.php (P 241) Submitting your Form and Getting Results

11 Using Cookie Variables When a Web browser accepts a cookie, you can’t extract its value until the next HTTP request is made. Using Cookie with Authentication Example: do_authuser.php (P 242) Checking for the Authentication Cookie Example: secreatA.php and secretB.php ( P 245) Submitting your Form and Getting Results

12 Session Basics Start a session Add a variable to the $_session superglobal Enable a per-user access count Maintain user preference throughout multiple pages

13 Session Basics Before You Begin … Check php.ini What’s a Session? –A session is the amount of time during which a user visits a site. –A session can hold all sorts of variables and values. Understanding Session Variables –A session variables ( and their values) are stored in the temporary session file on the Web server. You can access session variables through the $_SESSION superglobal.

14 Session Basics When you attempt to retrieve a session variable, the sequence goes something like this: 1.The PHP parser gets the value of PHPSESSID form the user cookie. 2.The PHP parser finds a matching temporary session file. 3.Inside the session file, the PHP parser looks for count and then finds its value (say, 76). 4.$_SESSION[count] is equal to 76.

15 Starting a Session Call the session_start() function, and PHP takes care of the rest- sending the cookie and creating the temporary file. Example:session.php (P 251) Submitting your Form and Getting Results

16 Registering and Modifying Session Variables The goal of this script is to register a variable and change its value during the course of a user session. Example:countme.php (P 253) Submitting your Form and Getting Results

17 Managing User Preferences with Sessions Starting a Session and registering Defaults –In this script, you’ll start a session and register the font_family and font_size variables. The displayed HTML will be a form that allows you to change your preferences. Example:session01.php (P 257) Submitting your Form and Getting Results

18 Managing User Preferences with Sessions Making Preference Changes –In this script, you’ll assign the new values for font_family and font_size and display a confirmation that the changes have been made. Example:session02.php (P 259) Submitting your Form and Getting Results (Display Changes)

19 Chapter Summary Database_Driven User Authentication Using Cookies Session Basics

20 Homework and Project 2 Homework –Due Date: Next Week Project 2 –Due Date: Week 9