PHP-language, sessions Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management

Slides:



Advertisements
Similar presentations
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
Advertisements

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.
PHP and the Web: Session : 4. Predefined variables PHP provides a large number of predefined global variables to any script which it runs also called.
PHP-language, files Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management
>> PHP: Access Control & Security. Authentication: Source Authentication Source Hard-coded File-Based The username and password is available inside the.
Chapter 10 Managing State Information Using Sessions.
©2009 Justin C. Klein Keane PHP Code Auditing Session 7 Sessions and Cookies Justin C. Klein Keane
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.
CSE 154 LECTURE 13: SESSIONS. Expiration / persistent cookies setcookie("name", "value", expiration); PHP $expireTime = time() + 60*60*24*7; # 1 week.
Php cookies & sessions.
Development of Web Applications - Introduction Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Website Security ISYS 475. Authentication Authentication is the process that determines the identity of a user.
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.
PHP Tutorial - Anas Jaghoub Chapter 2 Control Structures.
Web Programming Language Week 7 Dr. Ken Cosh Security, Sessions & Cookies.
12/3/2012ISC329 Isabelle Bichindaritz1 PHP and MySQL Advanced Features.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
1 Maryland ColdFusion User Group Session Management December 2001 Michael Schuler
Nic Shulver, Introduction to Sessions in PHP Sessions What is a session? Example Software Software Organisation The login HTML.
Cookies & Session Web Technology
PHP Workshop ‹#› Maintaining State in PHP Part II - Sessions.
SessionsPHPApril 2010 : [‹#›] Maintaining State in PHP Part II - Sessions.
PHP. $_GET / $_POST / $_SESSION PHP uses predefined variables to provide access to important information about the server and requests from a browser.
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.
PHP-language, conditional statements Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management.
Sessions in PHP – Page 1 of 13CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: Sessions in PHP Reading: Williams.
Web Database Programming Week 7 Session Management & Authentication.
Cookies and Sessions IDIA 618 Fall 2014 Bridget M. Blodgett.
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.
Advanced Web 2012 Lecture 6 Sean Costain Files Sean Costain 2012 Php allows for the : Creation Reading Appending Deleting Uploading And Closing.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
PHP-language Variables, assingment and arithmetic operations Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and.
PHP Session ISYS 475. Session The web server starts a session when a visitor visiting your web site and assigns a unique id, the session id for the session.
How to maintain state in a stateless web Shirley Cohen
Sessions Brendan Knight A visitor accessing your web site is assigned a unique id. This id links to specific data that remains on the server. Sessions.
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)
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)
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.
1 CS428 Web Engineering Lecture 22 Building Dynamic Web pages (PHP - V)
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 3 PHP Advanced.
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.
PHP-language, loops Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
COOKIES AND SESSIONS.
Programming for the Web Cookies & Sessions Dónal Mulligan BSc MA
PHP – Hypertext Preprocessor.
Sessions and cookies MIS 3501, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 4/12/2016.
PHP-language, database- programming Teppo Räisänen Oulu University of Applied Sciences School of Business and Information Management.
Brad N Greenwood, PhD MBA
Sessions and cookies MIS 3501 Jeremy Shafer Department of MIS
Development of Web Applications - Introduction
Development of Web Applications – Introduction revisited
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.
Web Programming Language
Cookies and Sessions in PHP
<?php require("header.htm"); ?>
Sessions and cookies (part 1)
CSE 154 Lecture 21: Sessions.
Sessions and cookies MIS 3501 Jeremy Shafer Department of MIS
Web Programming Language
CSE 154 Lecture 22: Sessions.
SESSION TRACKING BY DINESH KUMAR.R.
Web Programming Language
Presentation transcript:

PHP-language, sessions Teppo Räisänen Principal Lecturer Oulu University of Applied Sciences School of Business and Information Management

Why sessions? InternetServer (e. g. oamk.fi) HTTP-Request (X)HTML presented by the browser (X)HTML processed by the server HTTP-Reply Browser

Why sessions? Because of HTTP-protocol No continuous connection between browser and server Often we need to know previous actions and information is our web-application (e. g. NetBank) NetBank

Lifecyckle of a session time loginpage 1page 2page nlogout entry exit session

Sessions Is identified by session ID Preserve data between multiple calls Information about a session is stored to server (e.g. to memory, file or database Session ID storing and propagation – HTTP GET – Cookie

Sessions in PHP Use following functions and superglobals – session_start() – $_SESSION[] – session_destroy() – unset() – …

Session_start() Is used in EVERY page where session variables are needed in your applications Has to be the FIRST line in your source code, otherwise...

Session variables Place where to store information that can be read and write during session In PHP you use superglobal $_SESSION[]

$_SESSION[] To read and write session spesific information $_SESSION[’mySessionVar’]=$somevariable; $somevariable=$_SESSION[’mySessionVar’];

Session_destroy() Destroy session and all session spesific variables Used e.g. when user logs out from your application If there is login, you should ALWAYS have logout

Checking for SESSION-variable To check if there is spesific session variable use isset()- function Example: if isset($_SESSION[’somevariable’]) { print ”Session variable is set!”; } else { print ”Session variable is not set!”; }

Resources p p