Soumettre la recherche
Mettre en ligne
Cookies in php lecture 1
•
Télécharger en tant que PPT, PDF
•
3 j'aime
•
1,336 vues
Mudasir Syed
Suivre
Cookies in php lecture 1
Lire moins
Lire la suite
Formation
Signaler
Partager
Signaler
Partager
1 sur 27
Télécharger maintenant
Recommandé
MySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
Memory management
Memory management
Vishal Singh
Oracle User Management
Oracle User Management
Arun Sharma
File system
File system
Mohd Arif
Dataguard presentation
Dataguard presentation
Vimlendu Kumar
Oracle architecture with details-yogiji creations
Oracle architecture with details-yogiji creations
Yogiji Creations
MySql slides (ppt)
MySql slides (ppt)
webhostingguy
MYSQL
MYSQL
Ankush Jain
Recommandé
MySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
Memory management
Memory management
Vishal Singh
Oracle User Management
Oracle User Management
Arun Sharma
File system
File system
Mohd Arif
Dataguard presentation
Dataguard presentation
Vimlendu Kumar
Oracle architecture with details-yogiji creations
Oracle architecture with details-yogiji creations
Yogiji Creations
MySql slides (ppt)
MySql slides (ppt)
webhostingguy
MYSQL
MYSQL
Ankush Jain
Virtual memory ppt
Virtual memory ppt
Punjab College Of Technical Education
Windows batch scripting
Windows batch scripting
ArghodeepPaul
Java swing
Java swing
Apurbo Datta
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
Al-Mamun Sarkar
Io streams
Io streams
Elizabeth alexander
operating system structure
operating system structure
Waseem Ud Din Farooqui
Directory structure
Directory structure
sangrampatil81
MySQL constraints
MySQL constraints
Harish Gyanani
File based approach
File based approach
PreethaAS
Operating system 22 threading issues
Operating system 22 threading issues
Vaibhav Khanna
File organization and introduction of DBMS
File organization and introduction of DBMS
VrushaliSolanke
What is Constructors and Destructors in C++ (Explained with Example along wi...
What is Constructors and Destructors in C++ (Explained with Example along wi...
Pallavi Seth
Page replacement algorithms
Page replacement algorithms
Piyush Rochwani
Memory management
Memory management
cpjcollege
Memory management ppt
Memory management ppt
ManishaJha43
Database Fundamental
Database Fundamental
Gong Haibing
Backup & recovery with rman
Backup & recovery with rman
itsabidhussain
Protection and Security in Operating Systems
Protection and Security in Operating Systems
vampugani
Backup and recovery in oracle
Backup and recovery in oracle
sadegh salehi
Disk management
Disk management
Agnas Jasmine
Cookies in php lecture 2
Cookies in php lecture 2
Mudasir Syed
Presentation on Internet Cookies
Presentation on Internet Cookies
Ritika Barethia
Contenu connexe
Tendances
Virtual memory ppt
Virtual memory ppt
Punjab College Of Technical Education
Windows batch scripting
Windows batch scripting
ArghodeepPaul
Java swing
Java swing
Apurbo Datta
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
Al-Mamun Sarkar
Io streams
Io streams
Elizabeth alexander
operating system structure
operating system structure
Waseem Ud Din Farooqui
Directory structure
Directory structure
sangrampatil81
MySQL constraints
MySQL constraints
Harish Gyanani
File based approach
File based approach
PreethaAS
Operating system 22 threading issues
Operating system 22 threading issues
Vaibhav Khanna
File organization and introduction of DBMS
File organization and introduction of DBMS
VrushaliSolanke
What is Constructors and Destructors in C++ (Explained with Example along wi...
What is Constructors and Destructors in C++ (Explained with Example along wi...
Pallavi Seth
Page replacement algorithms
Page replacement algorithms
Piyush Rochwani
Memory management
Memory management
cpjcollege
Memory management ppt
Memory management ppt
ManishaJha43
Database Fundamental
Database Fundamental
Gong Haibing
Backup & recovery with rman
Backup & recovery with rman
itsabidhussain
Protection and Security in Operating Systems
Protection and Security in Operating Systems
vampugani
Backup and recovery in oracle
Backup and recovery in oracle
sadegh salehi
Disk management
Disk management
Agnas Jasmine
Tendances
(20)
Virtual memory ppt
Virtual memory ppt
Windows batch scripting
Windows batch scripting
Java swing
Java swing
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
Io streams
Io streams
operating system structure
operating system structure
Directory structure
Directory structure
MySQL constraints
MySQL constraints
File based approach
File based approach
Operating system 22 threading issues
Operating system 22 threading issues
File organization and introduction of DBMS
File organization and introduction of DBMS
What is Constructors and Destructors in C++ (Explained with Example along wi...
What is Constructors and Destructors in C++ (Explained with Example along wi...
Page replacement algorithms
Page replacement algorithms
Memory management
Memory management
Memory management ppt
Memory management ppt
Database Fundamental
Database Fundamental
Backup & recovery with rman
Backup & recovery with rman
Protection and Security in Operating Systems
Protection and Security in Operating Systems
Backup and recovery in oracle
Backup and recovery in oracle
Disk management
Disk management
Similaire à Cookies in php lecture 1
Cookies in php lecture 2
Cookies in php lecture 2
Mudasir Syed
Presentation on Internet Cookies
Presentation on Internet Cookies
Ritika Barethia
GDPR Cookies Policy
GDPR Cookies Policy
GDPR Privacy Policy
Cookies: A brief Introduction
Cookies: A brief Introduction
HTS Hosting
What is digital marketing by prof. (Dr.) Gaurav Sood
What is digital marketing by prof. (Dr.) Gaurav Sood
Gaurav Sood
Cookie testing
Cookie testing
BugRaptors
07 cookies
07 cookies
snopteck
Cookies
Cookies
Creative Secondary School
16 cookies
16 cookies
Abhijit Gaikwad
Enterprise java unit-2_chapter-2
Enterprise java unit-2_chapter-2
sandeep54552
Data Mining - GCPCUG May 2011
Data Mining - GCPCUG May 2011
Greater Cleveland PC Users Group
Mozilla firefox support phone number
Mozilla firefox support phone number
williampaul108
APEX & Cookie Monster
APEX & Cookie Monster
Christian Rokitta
What Is Evercookie and Why You Should Avoid It for Privacy’s Sake
What Is Evercookie and Why You Should Avoid It for Privacy’s Sake
Piwik PRO
Cookies: HTTP state management mechanism
Cookies: HTTP state management mechanism
Jivan Nepali
Internet cookies
Internet cookies
Abhi Bhardwaj
The ultimate guide to mining bitcoin with cryptotab
The ultimate guide to mining bitcoin with cryptotab
Said Dhaouadi
Cookies and sessions
Cookies and sessions
Sukrit Gupta
Ch4(saving state with cookies and query strings)
Ch4(saving state with cookies and query strings)
Chhom Karath
Internet cookies
Internet cookies
Abhi Bhardwaj
Similaire à Cookies in php lecture 1
(20)
Cookies in php lecture 2
Cookies in php lecture 2
Presentation on Internet Cookies
Presentation on Internet Cookies
GDPR Cookies Policy
GDPR Cookies Policy
Cookies: A brief Introduction
Cookies: A brief Introduction
What is digital marketing by prof. (Dr.) Gaurav Sood
What is digital marketing by prof. (Dr.) Gaurav Sood
Cookie testing
Cookie testing
07 cookies
07 cookies
Cookies
Cookies
16 cookies
16 cookies
Enterprise java unit-2_chapter-2
Enterprise java unit-2_chapter-2
Data Mining - GCPCUG May 2011
Data Mining - GCPCUG May 2011
Mozilla firefox support phone number
Mozilla firefox support phone number
APEX & Cookie Monster
APEX & Cookie Monster
What Is Evercookie and Why You Should Avoid It for Privacy’s Sake
What Is Evercookie and Why You Should Avoid It for Privacy’s Sake
Cookies: HTTP state management mechanism
Cookies: HTTP state management mechanism
Internet cookies
Internet cookies
The ultimate guide to mining bitcoin with cryptotab
The ultimate guide to mining bitcoin with cryptotab
Cookies and sessions
Cookies and sessions
Ch4(saving state with cookies and query strings)
Ch4(saving state with cookies and query strings)
Internet cookies
Internet cookies
Plus de Mudasir Syed
Error reporting in php
Error reporting in php
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
Form validation with built in functions
Form validation with built in functions
Mudasir Syed
Form validation server side
Form validation server side
Mudasir Syed
Plus de Mudasir Syed
(20)
Error reporting in php
Error reporting in php
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
Form validation with built in functions
Form validation with built in functions
Form validation server side
Form validation server side
Dernier
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Steve Thomason
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
FatimaKhan178732
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
nomboosow
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Pooja Nehwal
mini mental status format.docx
mini mental status format.docx
PoojaSen20
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
JemimahLaneBuaron
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
RaunakKeshri1
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
EduSkills OECD
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Thiyagu K
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
Disha Kariya
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
Maksud Ahmed
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
TechSoup
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
Association for Project Management
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
Jayanti Pande
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Sapana Sha
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
RAM LAL ANAND COLLEGE, DELHI UNIVERSITY.
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
misteraugie
Dernier
(20)
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
mini mental status format.docx
mini mental status format.docx
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
Cookies in php lecture 1
1.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Hidaya Institute of Science & Technology www.histpk.org A Division of Hidaya Trust, Pakistan
2.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org COOKIES
3.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Did you know? “ Cookies were invented by Netscape, which wanted to use them for creating a shopping cart for an online shop. Thanks to cookies people were able to keep items in their cart, even after disconnecting from the shop. ”
4.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • What are Cookies? • What information Cookies Store? • Why Cookies are Needed? • How to Enable Cookies? • How Cookies Work? • Where Cookies Reside? • Types of Cookies • Malicious Cookie Usage Topics To be Covered
5.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Lecture# 1
6.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • A little piece of data that is stored in a file (format depends on browser) on the user / client machine. • On the request of a webserver, your browser creates such a file (cookie). • Each time the user goes to a webpage this (cookie) information can be requested by the webpage. • The webserver can read and write content from and to this file. What are Cookies?
7.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Cookie can hold any information, but usually applications use cookies to store user's specific information (login, encrypted password, last visited date, etc). What information Cookies Store?
8.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org When dealing with cookies, you should be aware of some ground rules: • Cookies are used to record information about your activities on a particular domain, therefore they can only be read / write by the domain that created them and their subdomains. • According to the HTTP protocol, cookies can’t be larger than 4096 Bytes (4KB) each. • Usually, A maximum of 20 cookies can be stored on a user’s PC / Client per domain, but may differ on different browser. • Usually total number of cookies on the client’s harddrive is limited to around 300 cookies. This may also differ per browser.
9.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • Cookies are typically needed to bypass the stateless nature of the HTTP protocol, by using the client’s disk as a storage area for permanent data. • However, they’re dependent on the client browser being configured to accept cookies. Why Cookies are Needed?
10.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org To enable cookies in Chrome: •Click the wrench icon. •Select Settings. •Click Show advanced settings. •Click Content settings in the "Privacy" section. •Select Allow local data to be set to allow both first-party and third- party cookies. If you only want to accept first-party cookies, check the box next to "Block all third-party cookies without exception." How to Enable Cookies?
11.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org To enable cookies in Mozilla Firefox 3.x for Windows: • Click Tools > Options. • Click Privacy in the top panel. • Set "Firefox will:" to Use custom settings for history. • Check the box next to "Accept cookies from sites" to enable cookies. • Click OK. How to Enable Cookies? (contd…)
12.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org To enable cookies in Mozilla Firefox 2.x for Windows: • Click Tools > Options. • Click Privacy in the top panel. • Select the checkbox labeled "Accept cookies from sites." • Click OK. How to Enable Cookies? (contd…)
13.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org To enable cookies in Internet Explorer 7 or 8: • Click Start > Control Panel. (With Windows XP Classic View, click the Windows Start button >Settings > Control Panel). • Double-click the Internet Options icon. • Select the Privacy tab and Click Advanced. • Select "Override automatic cookie handling" under the "Cookies" section in the Advanced Privacy Settings window. • Select the "Accept" or "Prompt" option under "First-party Cookies." • Select the "Accept" or "Prompt" option under "Third-party Cookies." (If you select the "Prompt" option, you'll be asked for approval every time a website attempts to send you a cookie.) • In the Internet Options window, click OK to exit. How to Enable Cookies? (contd…)
14.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org To enable cookies in Internet Explorer 6: • Click Start > Control Panel. (With Windows XP Classic View, click the Windows Start button >Settings > Control Panel). • Click Advanced. • Select "Override Automatic Cookie Handling." • Select the "Accept" or "Prompt" option under "First-party Cookies." • Select the "Accept" or "Prompt" option under "Third-party Cookies." (If you select the "Prompt" option, you'll be asked for approval every time a website attempts to send you a cookie.) • In the Internet Options window, click OK to exit. How to Enable Cookies? (contd…)
15.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org To enable cookies in Safari: • Go to the Safari drop-down menu. • Select Preferences. • Click Security in the top panel. • Under "Accept Cookies" select Only from sites you navigate to. How to Enable Cookies? (contd…)
16.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • Setcookie() is to let the browser know that the server would like to create a new cookie. • Use $_COOKIE variable (array) to retrieve a cookie. How it works: 1) initial state, just before user opens some-page.php in the browser. $_COOKIE array is empty at this point. No cookie in the browser at this point. How Cookies Work?
17.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org 2) some-page.php sets cookie named "my-cookie" via setcookie php function, and cookie goes to the browser along with page content $_COOKIE array is still empty at this point. Browser has cookie "my-cookie" at this point. 3) next time user opens some-page.php (or after refresh) $_COOKIE array now contains "my-cookie". Browser still has cookie "my-cookie". How Cookies Work? (contd…)
18.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • In Google Chrome: – Windows XP: C:Users<USERNAME> Local SettingsApplication DataGoogle ChromeUser Data – Windows Vista & 7: C:Users<USERNAME> AppDataLocalGoogleChromeUser Datadefault Shortcut: Go to Start -> run -> type “%USERPROFILE%” this will view you the current user folder Where Cookies Reside?
19.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org “ The most important thing to remember, when creating a cookie in PHP, is that you must set all cookies before you send any data to the browser. This means that you should always initialise new cookies before any output. This includes echo() or print() commands, and the <html> or <body> tags. Of course, there are some exceptions, but this is a general rule of thumb. ” Before Setting Cookie
20.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • Session Cookies • Persistent Cookies Types of Cookies
21.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Session Cookies • Session cookie is also called Temporary cookie • Session cookie is stored only for your current browsing session, and is deleted from your computer when you close your browser.
22.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org setcookie() function is use to create the cookie bool setcookie ( string name [, string value]) • name: This argument sets the name of the cookie. for example setcookie(‘mycookie’, …) will set mycookie and is called $_COOKIE['mycookie'] at server side. • value: This will set the value of the cookie. Since this values is stored on the client browser extra care must be taken that it does not store some secure information e.g non-encrypted passwords. The value is accessed by $_COOKIE['mycookie'] at the web server. • All the attributes are optional, only the first (name) is not optional. Session Cookies (contd…)
23.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org <?php setcookie(‘username‘,’admin’); ?> <?php echo $_COOKIE[‘username’]; ?> Setting and Retrieving Cookies
24.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • Once a cookie has been set for a domain, it becomes available in the special $_COOKIE associative array, and its value may be accessed using standard array notation. <?php // if cookie present, use it // else display generic message if ($_COOKIE['username']) { echo "Welcome back, " . $_COOKIE['username']; } else { echo “You are not signed in"; } ?> • To check whether your cookies are working correctly, use the statement <?php print_r($_COOKIE); ?> to look inside PHP’s special $_COOKIE array. Retrieving Cookie Data
25.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org • Only strings can be stored in Cookie files. • To store an array in a cookie, convert it to a string by using the serialize() PHP function. • The array can be reconstructed using the unserialize() function once it had been read back in. • Remember cookie size is limited! NOTE: You really shouldn't use (un)serialize with cookies without encoding them. An evil user could inject ANY code in your script. Use of encoding: e.g: base64_encode(serialize(cookie_data)) Storing an array..
26.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org 1. Change Background & foreground (text) color of webpage. Store their information in Cookies to retain changes. 2. Make Email Box, user login (use cookies in login). On Welcome page, should have compose email, inbox, drafts, sent, trash. Make complete Email Box System. Note: Emails should be stored in database. Assignments
27.
© Copyright 2012
Hidaya Trust (Pakistan) ● A Non-Profit Organization ● www.hidayatrust.org / www,histpk.org Username: Password: ali@yahoo.com ………. Login Enter Username & Password Click Compose Inbox Sent Trash Draft Welcome “Ali” Email System To Sub Cc Message Send Compose Inbox Sent Trash Draft Welcome “Ali” Email System Check Name SubjectCheck Name Subject Ali GreetingsAli Greetings Ahmed WorkAhmed Work Aslam AssignmentAslam Assignment Delete Compose Inbox Sent Trash Draft Welcome “Ali” Email System Check Name SubjectCheck Name Subject Ali Greetings ReplyAli Greetings Reply Ahmed WorkAhmed Work Aslam AssignmentAslam Assignment Delete Compose Inbox Sent Trash Draft Welcome “Ali” Email System Check Name SubjectCheck Name Subject Ali GreetingsAli Greetings Ahmed WorkAhmed Work Aslam AssignmentAslam Assignment Delete
Télécharger maintenant