Enviar pesquisa
Carregar
Sessions in php
•
Transferir como PPTX, PDF
•
1 gostou
•
3,901 visualizações
Mudasir Syed
Seguir
Sessions in php
Leia menos
Leia mais
Educação
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 26
Baixar agora
Recomendados
PHP Cookies and Sessions
PHP Cookies and Sessions
Nisa Soomro
Php mysql ppt
Php mysql ppt
Karmatechnologies Pvt. Ltd.
MYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
HTML Forms
HTML Forms
Ravinder Kamboj
Sessions and cookies
Sessions and cookies
www.netgains.org
Php and MySQL
Php and MySQL
Tiji Thomas
jQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
Web technology lab manual
Web technology lab manual
neela madheswari
Recomendados
PHP Cookies and Sessions
PHP Cookies and Sessions
Nisa Soomro
Php mysql ppt
Php mysql ppt
Karmatechnologies Pvt. Ltd.
MYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
HTML Forms
HTML Forms
Ravinder Kamboj
Sessions and cookies
Sessions and cookies
www.netgains.org
Php and MySQL
Php and MySQL
Tiji Thomas
jQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
Web technology lab manual
Web technology lab manual
neela madheswari
Web Technology Lab File
Web Technology Lab File
Kandarp Tiwari
JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
WebStackAcademy
java Cookies
java Cookies
Rajanivetha G
Files in php
Files in php
sana mateen
PHP - Introduction to PHP Cookies and Sessions
PHP - Introduction to PHP Cookies and Sessions
Vibrant Technologies & Computers
Event Handling in java
Event Handling in java
Google
Database Connectivity in PHP
Database Connectivity in PHP
Taha Malampatti
Css box-model
Css box-model
Webtech Learning
Php sessions & cookies
Php sessions & cookies
baabtra.com - No. 1 supplier of quality freshers
Form Validation in JavaScript
Form Validation in JavaScript
Ravi Bhadauria
Servlet and servlet life cycle
Servlet and servlet life cycle
Dhruvin Nakrani
Html frames
Html frames
eShikshak
PHP Form Validation Technique
PHP Form Validation Technique
Morshedul Arefin
Presentation of bootstrap
Presentation of bootstrap
1amitgupta
Php array
Php array
Nikul Shah
jQuery
jQuery
Jay Poojara
Xml parsers
Xml parsers
Manav Prasad
Introduction to php
Introduction to php
Taha Malampatti
HTTP Request and Response Structure
HTTP Request and Response Structure
BhagyashreeGajera1
Bootstrap 5 ppt
Bootstrap 5 ppt
Mallikarjuna G D
Php session 3 Important topics
Php session 3 Important topics
Spy Seat
Php 03 Sessoes Cookies Cabecalhos
Php 03 Sessoes Cookies Cabecalhos
Regis Magalhães
Mais conteúdo relacionado
Mais procurados
Web Technology Lab File
Web Technology Lab File
Kandarp Tiwari
JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
WebStackAcademy
java Cookies
java Cookies
Rajanivetha G
Files in php
Files in php
sana mateen
PHP - Introduction to PHP Cookies and Sessions
PHP - Introduction to PHP Cookies and Sessions
Vibrant Technologies & Computers
Event Handling in java
Event Handling in java
Google
Database Connectivity in PHP
Database Connectivity in PHP
Taha Malampatti
Css box-model
Css box-model
Webtech Learning
Php sessions & cookies
Php sessions & cookies
baabtra.com - No. 1 supplier of quality freshers
Form Validation in JavaScript
Form Validation in JavaScript
Ravi Bhadauria
Servlet and servlet life cycle
Servlet and servlet life cycle
Dhruvin Nakrani
Html frames
Html frames
eShikshak
PHP Form Validation Technique
PHP Form Validation Technique
Morshedul Arefin
Presentation of bootstrap
Presentation of bootstrap
1amitgupta
Php array
Php array
Nikul Shah
jQuery
jQuery
Jay Poojara
Xml parsers
Xml parsers
Manav Prasad
Introduction to php
Introduction to php
Taha Malampatti
HTTP Request and Response Structure
HTTP Request and Response Structure
BhagyashreeGajera1
Bootstrap 5 ppt
Bootstrap 5 ppt
Mallikarjuna G D
Mais procurados
(20)
Web Technology Lab File
Web Technology Lab File
JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
java Cookies
java Cookies
Files in php
Files in php
PHP - Introduction to PHP Cookies and Sessions
PHP - Introduction to PHP Cookies and Sessions
Event Handling in java
Event Handling in java
Database Connectivity in PHP
Database Connectivity in PHP
Css box-model
Css box-model
Php sessions & cookies
Php sessions & cookies
Form Validation in JavaScript
Form Validation in JavaScript
Servlet and servlet life cycle
Servlet and servlet life cycle
Html frames
Html frames
PHP Form Validation Technique
PHP Form Validation Technique
Presentation of bootstrap
Presentation of bootstrap
Php array
Php array
jQuery
jQuery
Xml parsers
Xml parsers
Introduction to php
Introduction to php
HTTP Request and Response Structure
HTTP Request and Response Structure
Bootstrap 5 ppt
Bootstrap 5 ppt
Destaque
Php session 3 Important topics
Php session 3 Important topics
Spy Seat
Php 03 Sessoes Cookies Cabecalhos
Php 03 Sessoes Cookies Cabecalhos
Regis Magalhães
Aula 11 - Controle de sessão em PHP - Programação Web
Aula 11 - Controle de sessão em PHP - Programação Web
Dalton Martins
Php - Getting good with session
Php - Getting good with session
Firdaus Adib
Aula 5 - Cookies e Sessões em PHP
Aula 5 - Cookies e Sessões em PHP
Lucas Augusto Fagundes
Cookie and session
Cookie and session
Aashish Ghale
Session por nieves
Session por nieves
Saregune Multimedia
Manipulação de formulários com PHP. Uso de Cookies e Session com PHP.
Manipulação de formulários com PHP. Uso de Cookies e Session com PHP.
Leonardo Soares
Cookies e Sessões e PHP
Cookies e Sessões e PHP
Humberto Moura
Php ssession - cookies -introduction
Php ssession - cookies -introduction
Programmer Blog
Php session
Php session
argusacademy
Php string function
Php string function
Ravi Bhadauria
Session php
Session php
200Hussain
Destaque
(13)
Php session 3 Important topics
Php session 3 Important topics
Php 03 Sessoes Cookies Cabecalhos
Php 03 Sessoes Cookies Cabecalhos
Aula 11 - Controle de sessão em PHP - Programação Web
Aula 11 - Controle de sessão em PHP - Programação Web
Php - Getting good with session
Php - Getting good with session
Aula 5 - Cookies e Sessões em PHP
Aula 5 - Cookies e Sessões em PHP
Cookie and session
Cookie and session
Session por nieves
Session por nieves
Manipulação de formulários com PHP. Uso de Cookies e Session com PHP.
Manipulação de formulários com PHP. Uso de Cookies e Session com PHP.
Cookies e Sessões e PHP
Cookies e Sessões e PHP
Php ssession - cookies -introduction
Php ssession - cookies -introduction
Php session
Php session
Php string function
Php string function
Session php
Session php
Semelhante a Sessions in php
season management in php (WT)
season management in php (WT)
kunjan shah
Php sessions
Php sessions
clickon2010
lecture 13.pptx
lecture 13.pptx
ITNet
PHP SESSIONS & COOKIE.pptx
PHP SESSIONS & COOKIE.pptx
ShitalGhotekar
Lecture8 php page control by okello erick
Lecture8 php page control by okello erick
okelloerick
4.4 PHP Session
4.4 PHP Session
Jalpesh Vasa
Security in php
Security in php
Jalpesh Vasa
PHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdf
HumphreyOwuor1
Manish
Manish
Manish Jain
Sessions n cookies
Sessions n cookies
baabtra.com - No. 1 supplier of quality freshers
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
SreejithVP7
Session Management & Cookies In Php
Session Management & Cookies In Php
Harit Kothari
php $_GET / $_POST / $_SESSION
php $_GET / $_POST / $_SESSION
tumetr1
session.ppt
session.ppt
pshtiwanabasabdulla
Php 07-cookies-sessions
Php 07-cookies-sessions
YUSRA FERNANDO
Jsp session tracking
Jsp session tracking
rvarshneyp
Authentication and Single Sing on
Authentication and Single Sing on
guest648519
PHP Interview Questions-ppt
PHP Interview Questions-ppt
Mayank Kumar
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHP
Lariya Minhaz
It and ej
It and ej
Harihar Kalia
Semelhante a Sessions in php
(20)
season management in php (WT)
season management in php (WT)
Php sessions
Php sessions
lecture 13.pptx
lecture 13.pptx
PHP SESSIONS & COOKIE.pptx
PHP SESSIONS & COOKIE.pptx
Lecture8 php page control by okello erick
Lecture8 php page control by okello erick
4.4 PHP Session
4.4 PHP Session
Security in php
Security in php
PHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdf
Manish
Manish
Sessions n cookies
Sessions n cookies
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
Session Management & Cookies In Php
Session Management & Cookies In Php
php $_GET / $_POST / $_SESSION
php $_GET / $_POST / $_SESSION
session.ppt
session.ppt
Php 07-cookies-sessions
Php 07-cookies-sessions
Jsp session tracking
Jsp session tracking
Authentication and Single Sing on
Authentication and Single Sing on
PHP Interview Questions-ppt
PHP Interview Questions-ppt
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHP
It and ej
It and ej
Mais de Mudasir Syed
Error reporting in php
Error reporting in php
Mudasir Syed
Cookies in php lecture 2
Cookies in php lecture 2
Mudasir Syed
Cookies in php lecture 1
Cookies in php lecture 1
Mudasir Syed
Ajax
Ajax
Mudasir Syed
Reporting using FPDF
Reporting using FPDF
Mudasir Syed
Oop in php lecture 2
Oop in php lecture 2
Mudasir Syed
Oop in php lecture 2
Oop in php lecture 2
Mudasir Syed
Filing system in PHP
Filing system in PHP
Mudasir Syed
Time manipulation lecture 2
Time manipulation lecture 2
Mudasir Syed
Time manipulation lecture 1
Time manipulation lecture 1
Mudasir Syed
Php Mysql
Php Mysql
Mudasir Syed
Adminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdmin
Mudasir Syed
Sql select
Sql select
Mudasir Syed
PHP mysql Sql
PHP mysql Sql
Mudasir Syed
PHP mysql Mysql joins
PHP mysql Mysql joins
Mudasir Syed
PHP mysql Introduction database
PHP mysql Introduction database
Mudasir Syed
PHP mysql Installing my sql 5.1
PHP mysql Installing my sql 5.1
Mudasir Syed
PHP mysql Er diagram
PHP mysql Er diagram
Mudasir Syed
PHP mysql Database normalizatin
PHP mysql Database normalizatin
Mudasir Syed
PHP mysql Aggregate functions
PHP mysql Aggregate functions
Mudasir Syed
Mais de Mudasir Syed
(20)
Error reporting in php
Error reporting in php
Cookies in php lecture 2
Cookies in php lecture 2
Cookies in php lecture 1
Cookies in php lecture 1
Ajax
Ajax
Reporting using FPDF
Reporting using FPDF
Oop in php lecture 2
Oop in php lecture 2
Oop in php lecture 2
Oop in php lecture 2
Filing system in PHP
Filing system in PHP
Time manipulation lecture 2
Time manipulation lecture 2
Time manipulation lecture 1
Time manipulation lecture 1
Php Mysql
Php Mysql
Adminstrating Through PHPMyAdmin
Adminstrating Through PHPMyAdmin
Sql select
Sql select
PHP mysql Sql
PHP mysql Sql
PHP mysql Mysql joins
PHP mysql Mysql joins
PHP mysql Introduction database
PHP mysql Introduction database
PHP mysql Installing my sql 5.1
PHP mysql Installing my sql 5.1
PHP mysql Er diagram
PHP mysql Er diagram
PHP mysql Database normalizatin
PHP mysql Database normalizatin
PHP mysql Aggregate functions
PHP mysql Aggregate functions
Último
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Carlos105
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
mary850239
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
Celine George
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
VanesaIglesias10
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
Humphrey A Beña
Visit to a blind student's school🧑🦯🧑🦯(community medicine)
Visit to a blind student's school🧑🦯🧑🦯(community medicine)
lakshayb543
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
cama23
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
JhezDiaz1
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
Anupkumar Sharma
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
leah joy valeriano
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
Postal Advocate Inc.
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
mary850239
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
AshokKarra1
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
shraddhaparab530
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
Celine George
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
Celine George
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
Patidar M
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
iammrhaywood
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
YousafMalik24
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
Mark Reed
Último
(20)
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
Visit to a blind student's school🧑🦯🧑🦯(community medicine)
Visit to a blind student's school🧑🦯🧑🦯(community medicine)
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
Sessions in php
1.
Session In Php By:
IQRA BALOCH.
2.
Contents What is
Session? Why, Where Session is Used? How Sessions Works? Session As File. Session Expiry Copyright © 2012 Muhammad Baqar Qazi.
3.
What Is Session?
Generally session means limited period of time. Or A meeting or period devoted to a particular activity. To get understood about sessions in php we need to go back and review our concepts regarding http, html, client and server. It was clearly observed that web is stateless. There is no continuous connection between client and server. For-example : The server does not know that the current page was requested in past by the user or not. A browser request a page from server – connection opens between both, server get the request and sends back the response – connection closed. Copyright © 2012 Iqra Baloch.
4.
What is Session
(Continued) Session: Is one that makes the web satefull. Simply maintaining the state. Allows to track information of user. A session is basically a way of storing variables and making them available across multiple pages on your web site. Session is unlike other variables in the sense that we are not passing them individually to each new page, but instead retrieving them from the session we open at beginning of each page. Copyright © 2012 Iqra Baloch.
5.
What is Session
(Continued) In web applications, a session is the sequence of interactions between the server and a user. A session refers to a period of activity when a PHP script stores state information on a Web server. All session data is stored on the server (usually in a database, to which the client does not have direct access) linked to that identifier. A PHP session provides an easy, but effective, way of passing variables between web pages in a PHP application. The session starts when a PHP site is accessed and ends when the user closes their web browser. Copyright © 2012 Iqra Baloch.
6.
Why, Where Session
is used (Need)? Previously we store the information in a hidden form field. Even then, it persists only if the form is submitted. To make data accessible across the various pages of an entire website. Suppose a user is buying book online, there should be a mechanism to keep track of books added by user to basket. Very common example be the login system, where there is need of state maintenance to check whether user is logged in or not- is the user valid. Copyright © 2012 Iqra Baloch.
7.
How Session Work
Session Is a file stored on Server. To find which file belongs to which user a cookie is created. A special session cookie is set on their browser and then we look that cookie to find the place where a file resides on our server and then we can look in that file to find information in session. The information is not there for them to see or to edit they can only change id which reference to file. They can change id number is very long and complicated to help to ensure we do not end up with hijacking of other users session information. Copyright © 2012 Iqra Baloch.
8.
How Session Works
(Continued) To use session we use to create a file and set cookie on user machine. Then we need to find the cookie and the corresponding file on the machine this be done with session_start(). The session_start() function starts a new session or continues an existing one The session_start() function generates a unique session ID to identify the session A session ID is a random alphanumeric string that looks something like: 7f39d7dd020773f115d753c71290e11f The session_start() function creates a text file on the Web server that is the same name as the session ID, preceded by sess_ Copyright © 2012 Iqra Baloch.
9.
How Session Works
(Continued) <?php session_start(); ?> This command should be called only once in each page, and it must be called before the PHP script generates any output, so the ideal position is immediately after the opening PHP tag. If any output is generated before the call to session_start(), the command fails and the session won’t be activated for that page. Copyright © 2012 Iqra Baloch.
10.
How Session Works
(Continued) When a session is initiated, the server stores information in session variables that can be accessed by other pages as long as the session remains active (normally until the browser is closed). Because the identifier is unique to each visitor, the information stored in session variables cannot be seen by anyone else. Copyright © 2012 Iqra Baloch.
11.
Session As File.
The cookie stored in the browser is called PHPSESSID, unique identifier. A matching file, which contains the same unique identifier as part of its filename, is created on the web server. PHP sessions store a unique identifier as a cookie in the browser (left) and on the server(right). Copyright © 2012 Iqra Baloch.
12.
Session As File(Continued).
There is no danger of private information being exposed through someone examining the contents of a cookie on a shared computer. The session variables and their values are stored on the web server. Figure Shows contents of a simple session file. As you can see, it’s in plain text, and the content isn’t difficult to decipher. The session shown in the figure has two variables: name and location. The variable names are followed by a vertical pipe, then the letter “s”, a colon, a number, another colon, and the variable’s value in quotes. The “s” stands for string, and the number indicates how many characters the string contains. Copyright © 2012 Iqra Baloch.
13.
Storing & Retrieving
Session Data Php provides us the $_SESSION[] – Environment variable. We can use $_SESSION[“varibaleName”] to store and retrieve data as we do in our normal practice. Example: <?php session_start(); $_SESSION[“varibaleName”]=“THIS IS DATA TO BE STORED”; echo $_SESSION[“varibaleName”]; ?> Copyright © 2012 Iqra Baloch.
14.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Using Session Data/Variables • Having established a session, you can now create, store and retrieve information pertaining to that session. • Information to be stored for a session is kept in session variables. • This is where you both store and retrieve session data. • These variables are all stored in a single array $_SESSION. • <?php session_start(); // this starts the session $_SESSION['color']='red'; // this sets variables in the session $_SESSION['size']='small'; $_SESSION['shape']='round'; ?>
15.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Retrieving Session Data • The PHP session's $_SESSION variables can be used in exactly the same way as other PHP variables. • To retrieve a session variable you simply need to echo that variable. • If you need to access that variable on any other page you need to start session first. • <?php session_start(); // this starts the session echo $_SESSION['color']; // this is session variable. echo $_SESSION['size']; echo $_SESSION['shape']; ?>
16.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 2 Page 1 Page 3 Page 4 Page 5 Page 6 Page 3 Page 1 Page 2 Page 4 Page 5 Page 6 Page 4 Page 1 Page 2 Page 3 Page 5 Page 6 Page 5 Page 1 Page 2 Page 3 Page 4 Page 6 Page 6 Page 1 Visits = 3 Page 2 Visits = 5 Page 3 Visits = 7 Page 4 Visits = 2 Page 5 Visits = 9 Assignment 1: Make six web pages, every page contain the links of all other pages, on the sixth page the result of all visited pages should be shown that how many times the user has visited each page.
17.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Assignment 2: • User login validation with session maintenance. Username: Password: Hidaya Trust Login Enter Username & Password Click Welcome Hidaya MY SITE Direct access Welcome Hidaya MY SITE Username: Password: Login Please Login First.
18.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Session Expiry: • By default, PHP sessions expire: • After a certain length of inactivity (default 1440s/24 min), the PHP garbage collection processes deletes session variables. • To check session expiry time stored in php.ini file we use: ini_get(“session.gc_maxlifetime”);
19.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Unset(): Description: • unset() destroys the specified variables. Return Values • No value is returned. Note : • If $_SESSION is used, use unset() to unregister a session variable, i.e. unset ($_SESSION['varname']);. Caution: • Do NOT unset the whole $_SESSION with unset($_SESSION) as this will disable the registering of session variables through the $_SESSION superglobal.
20.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_destroy: Description: • Destroys all data registered to a session. • session_destroy() destroys all of the data associated with the current session. • It does not unset any of the global variables associated with the session, or unset the session cookie. Return Values • Returns TRUE on success or FALSE on failure.
21.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_id: Description: • session_id() Get and/or set the current session id. Parameters: • id • If id is specified, it will replace the current session id. • session_id() needs to be called before session_start() for that purpose. • Depending on the session handler, not all characters are allowed within the session id. For example, the file session handler only allows characters in the range a-z A-Z 0-9 , (comma) and - (minus)! Return Values • session_id() returns the session id for the current session or the empty string ("") if there is no current session (no current session id exists).
22.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_id (Contd:) Example : <?php /* set the session id to hidaya */ session_id(“hidaya"); session_start(); echo “My session id is session_id<br />"; ?>
23.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_name: Description: • Get and/or set the current session name. Parameters: • name • The session name references the name of the session, which is used in cookies. It should contain only alphanumeric characters; it should be short and descriptive. If name is specified, the name of the current session is changed to its value. Warning The session name can't consist of digits only, at least one letter must be present. Otherwise a new session id is generated every time. Return Values • Returns the name of the current session.
24.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_name (Contd:) Example : <?php /* set the session name to MyWebsite */ session_name(“MyWebsite"); session_start(); echo “My session name is session_name<br />"; ?>
25.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_save_path: Description: • Get and/or set the current session save path. • session_save_path() returns the path of the current directory used to save session data. Parameters: • Path • Session data path. • If specified, the path to which data is saved will be changed. • session_save_path() needs to be called before session_start() for that purpose. Return Values: • Returns the path of the current directory used for data storage.
26.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org session_save_path:(Contd:) Example : <?php session_save_path("C:users"); session_start(); echo “My session path is session_save_path <br />"; ?>
Baixar agora