SlideShare a Scribd company logo
1 of 36
 Definition

:

Time span during which a browser interacts with
particular server.

Begins:
When a browser becomes connected to a particular
server.

Ends:
When browser ceases to be connected to that server coz:
1)Becomes connected to different server
2)Or it is Terminated
 HTTP – STATELESS PROTOCOL


STATELESS- No means to store information about

a session
 USES:

1) Many web sites creates profiles of clients by
remembering which parts of the site was
pursued–
ADVERTISEMENTS.

2) Server recognizes request from a client(who has
made earlier requests) from same site–
CUSTOMIZED INTERFACE.
-

Provides General Approach To Store information
about SESSIONS on Browser Itself.

-

Created by some software system on server such
as CGI program.
(CGI- Protocol used between browser and software
on server)

-

.


A text file which a website can store on its visitors‟
hard drives



Made up of numbers and letters



Generally, cookies are a simple ID file



Sometimes they can store more complicated
information



Also called “name-value pairs”


Most Cookies store just 1 data value



A Cookie may not exceed 4 Kb in size



Browsers are preprogrammed to allow a total of 300
Cookies, after which automatic deletion based on
expiry date and usage



Cookies have 3 key attributes: name, value and expiry
date
 Sites




use cookies to…

Track number of visitors
First timers vs. returning visitors
How often the user visits the site

 Why?



Frequent Buyer example
$$$ from Advertisers
 You

can find cookie files on your hard
drive, your “C” drive.
1)Stores info about msg.
2)Can Include 1 or more cookies

HEADER

MESSAGE

Request
SERVER

BROWSER
Response
1. User sends a request for page at www.example.com for
the first time.

page request
2. Server sends back the page xhtml to the browser AND
stores some data in a cookie on the user‟s PC.

xhtml
cookie data
3. At the next page request for domain www.example.com,
all cookie data associated with this domain is sent too.

page request
cookie data
ANATOMY OF A (SIMPLE) COOKIE
String of text with these attributes:
 The domain and path for which the cookie is valid
 The name of the cookie
 The value of the cookie
 The expiration date of the cookie
 Whether a secure connection needed
to use the cookie


Cookies allow servers to record browser activities,
Hence considered as a privacy concern.
Accordingly, browsers allow the client to change
the browser setting to refuse to accept cookies from
servers.
Drawback- clients that reject them render them
useless.
 CGI.pm module includes support for cookies in

Perl through cookie function.


Serves two tasks:
1) To Create a cookie
2) To retrieve existing cookies from HTTP
header of a request.


Form of call is:

cookie(-name => a_cookie_name,
-value => a_value,
-expires => a_time-value)
cookie name- string
value- scalar value, including references to arrays
and hashes
expires - specifies lifetime of a cookie,
can be expressed in many different units.
Example: +3d specifies 3 days
s - seconds
m - minutes
h - hours
M - months
y - years
now - right now
-ve value - kills cookie
Calling cookie function

1) Without parameters: Returns hash of all of the
cookies in the HTTP header of current request.

2) To retrieve the value of 1 cookie, the cookie
function is called with the name of the cookie.
For ex:
$age=cookie („age‟);
Gets the value of cookie named age.
Prog block To display all
cookies(with both name and values)
in a CGI prog use:
print “Cookie Name t Cookie value <br/>”;
foreach $name(keys cookie())
{
print “$name t cookie($name) <br/>”;
}
In CGI.pm,
A cookie is placed in the HTTP header when
header function is called with cookie as a
parameter passed to it as follows:

header(-cookie => $my_cookie)


Calls time function – time returns current time in
seconds since January 1,1970.

Converts the number of seconds into nine values:
1)$sec - seconds
2)$min - minutes
3)$hour - hour
4)$mday - day of the month
5)$mon - month (coded as 0 to 11)
6)$year - number of years since 1900
7)$wday - day of week (coded as 0 to 6; 0-sunday)
8)$yday - day_of the year
9)$isdst - Boolean; specifies whether the given time
is in daylight savings time

PROG TO DISPLAY ALL NINE VALUES
RETURNED BY

localtime:

#time_date.pl
#Input: None
#Output: The nine values returned by localtime
($sec, $min, $hour, $mday, $mon, $year, $wday,
$yday, $isdst) = localtime;
print “$sec= $sec n”;
print “$min= $minn”;
print “$hour= $hour n”;
print “$mday= $mday n”;
print “$mon= $mon n”;
print “$year= $year n”;
print “$wday= $wdayn”;
print “$yday= $yday n”;
print “$isdst= $isdstn”;
$sec = 43
$min = 20
$hour = 10
$mday =19
$mon = 2
$year = 105
$wday = 6
$yday = 77
$isdat = 0


For days of the week, we often prefer to get the
names rather than numbers…
this can be done in Perl as:
$day_of_week=(qw(Sunday Monday Tuesday
Wednesday Friday
Saturday))[(localtime)[6]];
where subscript 6 is for $wday
CGI PROG FOR CREATING GREETING
FOR VISITORS:
#!/usr/bin/perl
# day_cookie.pl
# A CGI program to use a cookie to remember the
day of the last login from a user and display it when
run
Use CGI “:standard”;
#>>> Get the existing day cookie, if there was one
@last_day = cookie(„last_time‟);
#>>> Get the current date and make the new
#>>> cookie
$day_of_week = (qw(Sunday Monday Tuesday
Wednesday Friday
Saturday))[(localtime)[6]];
$month=(qw(January February March April May
June July August September October
November December))[(localtime)[4]];
$day_of_month = (localtime)[3];
@day_stuff = ($day_of_week, $day_of_month,
$month);
$day_cookie = cookie(-name => „last_time‟,
-value => @day_stuff,
-expires => „+5d‟);
#>>> Produce the return document
#>>> First, put the cookie in the new header
print header(-cookie => $day_cookie);
print start_html(„This is day_cookie.pl‟);
#>>> If there was no day cookie, this is the first
#>>> visit
if(scalar(@last_day) == 0)
{
print “Welcome to you on your first visit to
our site<br/>”;
}
#>>> Otherwise, Welcome the user back and give
#>>> the date of the last visit
else
{

($day_of_week, $day_of_month, $month) =
@last_day;
print “Welcome back! <br/>”,
“Your last visit was on “,
“$day_of_week, $month $day_of_month
<br/>”;
}
print end_html;
OUTPUT
Welcome back!
Your last visit was on Friday,March 22
MMMM! COOKIES…


They remember usernames for various sites that
require log-in
 Also have the option to remember your
passwords for you!



They allow you to shop as you browse via online
shopping carts!



Cookies provide user customization of sites, like
weather.com & msn.com
COOKIE SCOPE: CAN DO


Store and manipulate any information you explicitly
provide to a site



Track your interaction with parent site such as pages
visited, time of visits, number of visits



Use any information available to web server including:
IP address, Operating System, Browser Type
LIFE WITHOUT COOKIES…


Many sites are heavily dependent on
cookies and may not function well
without them
 Some may not function at all



Erasing cookies prevents visitors from
making use of certain amenities sites
offer
CONCLUSION
 Cookies

were originally created as harmless
pieces of text for user convenience

 Along

the way, some evil geniuses found a
way to exploit them for business

 The

paranoia arises from the invisible nature
of cookie transactions and inadequate
information about their ability.
Cookies

More Related Content

What's hot

San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
MongoDB NoSQL and all of its awesomeness
MongoDB NoSQL and all of its awesomenessMongoDB NoSQL and all of its awesomeness
MongoDB NoSQL and all of its awesomenessTroy Grosfield
 
Mongo db modifiers
Mongo db modifiersMongo db modifiers
Mongo db modifierszarigatongy
 
Lecture8 php page control by okello erick
Lecture8 php page control by okello erickLecture8 php page control by okello erick
Lecture8 php page control by okello erickokelloerick
 
Ext GWT 3.0 Theming and Appearances
Ext GWT 3.0 Theming and AppearancesExt GWT 3.0 Theming and Appearances
Ext GWT 3.0 Theming and AppearancesSencha
 
Pymongo for the Clueless
Pymongo for the CluelessPymongo for the Clueless
Pymongo for the CluelessChee Leong Chow
 
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with PuppetPuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with PuppetOlinData
 
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with PuppetPuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with PuppetWalter Heck
 
C# Development (Sam Corder)
C# Development (Sam Corder)C# Development (Sam Corder)
C# Development (Sam Corder)MongoSF
 
Building accessible components
Building accessible componentsBuilding accessible components
Building accessible componentsRicky Onsman
 
mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成達郎 植田
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NETShingalaKrupa
 
Websockets, Ruby y Pusher Webprendedor 2010
Websockets, Ruby y Pusher Webprendedor 2010Websockets, Ruby y Pusher Webprendedor 2010
Websockets, Ruby y Pusher Webprendedor 2010Ismael Celis
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationMongoDB
 

What's hot (17)

San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
MongoDB NoSQL and all of its awesomeness
MongoDB NoSQL and all of its awesomenessMongoDB NoSQL and all of its awesomeness
MongoDB NoSQL and all of its awesomeness
 
Mongo db modifiers
Mongo db modifiersMongo db modifiers
Mongo db modifiers
 
Lecture8 php page control by okello erick
Lecture8 php page control by okello erickLecture8 php page control by okello erick
Lecture8 php page control by okello erick
 
Ext GWT 3.0 Theming and Appearances
Ext GWT 3.0 Theming and AppearancesExt GWT 3.0 Theming and Appearances
Ext GWT 3.0 Theming and Appearances
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
Pymongo for the Clueless
Pymongo for the CluelessPymongo for the Clueless
Pymongo for the Clueless
 
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with PuppetPuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet
 
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with PuppetPuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet
 
C# Development (Sam Corder)
C# Development (Sam Corder)C# Development (Sam Corder)
C# Development (Sam Corder)
 
Building accessible components
Building accessible componentsBuilding accessible components
Building accessible components
 
mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成
 
บท7
บท7บท7
บท7
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
 
Mongo db
Mongo dbMongo db
Mongo db
 
Websockets, Ruby y Pusher Webprendedor 2010
Websockets, Ruby y Pusher Webprendedor 2010Websockets, Ruby y Pusher Webprendedor 2010
Websockets, Ruby y Pusher Webprendedor 2010
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 

Viewers also liked

Winter deliverables ii
Winter deliverables iiWinter deliverables ii
Winter deliverables iijvj002
 
An_activity_I_enjoy:_Intense_physical_challenges
An_activity_I_enjoy:_Intense_physical_challengesAn_activity_I_enjoy:_Intense_physical_challenges
An_activity_I_enjoy:_Intense_physical_challengespj7291
 
On wireless scheduling algorithms for minimizing the queue overflow probability
On wireless scheduling algorithms for minimizing the queue overflow probabilityOn wireless scheduling algorithms for minimizing the queue overflow probability
On wireless scheduling algorithms for minimizing the queue overflow probabilityPreet Kanwal
 
Answer to question I - MDS presentation
Answer to question I - MDS presentationAnswer to question I - MDS presentation
Answer to question I - MDS presentationpj7291
 
Speech recognition1
Speech recognition1Speech recognition1
Speech recognition1Sai Kiran
 
Presentation1
Presentation1Presentation1
Presentation1nabil1927
 
SILABUS MULTIMEDIA LENGKAP
SILABUS MULTIMEDIA LENGKAPSILABUS MULTIMEDIA LENGKAP
SILABUS MULTIMEDIA LENGKAPTaufik Hidayat
 
Behavior-based robotics
Behavior-based roboticsBehavior-based robotics
Behavior-based roboticsPreet Kanwal
 

Viewers also liked (10)

Winter deliverables ii
Winter deliverables iiWinter deliverables ii
Winter deliverables ii
 
An_activity_I_enjoy:_Intense_physical_challenges
An_activity_I_enjoy:_Intense_physical_challengesAn_activity_I_enjoy:_Intense_physical_challenges
An_activity_I_enjoy:_Intense_physical_challenges
 
Key
KeyKey
Key
 
On wireless scheduling algorithms for minimizing the queue overflow probability
On wireless scheduling algorithms for minimizing the queue overflow probabilityOn wireless scheduling algorithms for minimizing the queue overflow probability
On wireless scheduling algorithms for minimizing the queue overflow probability
 
Answer to question I - MDS presentation
Answer to question I - MDS presentationAnswer to question I - MDS presentation
Answer to question I - MDS presentation
 
Speech recognition1
Speech recognition1Speech recognition1
Speech recognition1
 
Presentation1
Presentation1Presentation1
Presentation1
 
Grouper
GrouperGrouper
Grouper
 
SILABUS MULTIMEDIA LENGKAP
SILABUS MULTIMEDIA LENGKAPSILABUS MULTIMEDIA LENGKAP
SILABUS MULTIMEDIA LENGKAP
 
Behavior-based robotics
Behavior-based roboticsBehavior-based robotics
Behavior-based robotics
 

Similar to Cookies

PHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdfPHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdfHumphreyOwuor1
 
javaScriptCookies.pptx
javaScriptCookies.pptxjavaScriptCookies.pptx
javaScriptCookies.pptxMattMarino13
 
19_JavaScript - Storage_Cookies-tutorial .pptx
19_JavaScript - Storage_Cookies-tutorial .pptx19_JavaScript - Storage_Cookies-tutorial .pptx
19_JavaScript - Storage_Cookies-tutorial .pptxssuser4a97d3
 
Web app development_cookies_sessions_14
Web app development_cookies_sessions_14Web app development_cookies_sessions_14
Web app development_cookies_sessions_14Hassen Poreya
 
Php ssession - cookies -introduction
Php ssession - cookies -introductionPhp ssession - cookies -introduction
Php ssession - cookies -introductionProgrammer Blog
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)WebStackAcademy
 
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
Lecture 11 - PHP - Part 5 - CookiesSessions.pptLecture 11 - PHP - Part 5 - CookiesSessions.ppt
Lecture 11 - PHP - Part 5 - CookiesSessions.pptSreejithVP7
 
Java script Advance
Java script   AdvanceJava script   Advance
Java script AdvanceJaya Kumari
 
9781305078444 ppt ch09
9781305078444 ppt ch099781305078444 ppt ch09
9781305078444 ppt ch09Terry Yoast
 
19_JavaScript - Storage_Cookies_students.pptx
19_JavaScript - Storage_Cookies_students.pptx19_JavaScript - Storage_Cookies_students.pptx
19_JavaScript - Storage_Cookies_students.pptxVatsalJain39
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessionsSukrit Gupta
 
lecture 12.pptx
lecture 12.pptxlecture 12.pptx
lecture 12.pptxITNet
 
PHP COOKIES AND SESSIONS
PHP COOKIES AND SESSIONSPHP COOKIES AND SESSIONS
PHP COOKIES AND SESSIONSDegu8
 
murach12.pptx
murach12.pptxmurach12.pptx
murach12.pptxxiso
 
Ch4(saving state with cookies and query strings)
Ch4(saving state with cookies and query strings)Ch4(saving state with cookies and query strings)
Ch4(saving state with cookies and query strings)Chhom Karath
 

Similar to Cookies (20)

Sessions and cookies
Sessions and cookiesSessions and cookies
Sessions and cookies
 
PHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdfPHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdf
 
javaScriptCookies.pptx
javaScriptCookies.pptxjavaScriptCookies.pptx
javaScriptCookies.pptx
 
19_JavaScript - Storage_Cookies-tutorial .pptx
19_JavaScript - Storage_Cookies-tutorial .pptx19_JavaScript - Storage_Cookies-tutorial .pptx
19_JavaScript - Storage_Cookies-tutorial .pptx
 
4.4 PHP Session
4.4 PHP Session4.4 PHP Session
4.4 PHP Session
 
Web app development_cookies_sessions_14
Web app development_cookies_sessions_14Web app development_cookies_sessions_14
Web app development_cookies_sessions_14
 
Php ssession - cookies -introduction
Php ssession - cookies -introductionPhp ssession - cookies -introduction
Php ssession - cookies -introduction
 
ASP.NET-Web Programming - Sessions and Cookies
ASP.NET-Web Programming - Sessions and CookiesASP.NET-Web Programming - Sessions and Cookies
ASP.NET-Web Programming - Sessions and Cookies
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
Lecture 11 - PHP - Part 5 - CookiesSessions.pptLecture 11 - PHP - Part 5 - CookiesSessions.ppt
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
 
Java script Advance
Java script   AdvanceJava script   Advance
Java script Advance
 
Manish
ManishManish
Manish
 
9781305078444 ppt ch09
9781305078444 ppt ch099781305078444 ppt ch09
9781305078444 ppt ch09
 
19_JavaScript - Storage_Cookies_students.pptx
19_JavaScript - Storage_Cookies_students.pptx19_JavaScript - Storage_Cookies_students.pptx
19_JavaScript - Storage_Cookies_students.pptx
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
 
lecture 12.pptx
lecture 12.pptxlecture 12.pptx
lecture 12.pptx
 
PHP COOKIES AND SESSIONS
PHP COOKIES AND SESSIONSPHP COOKIES AND SESSIONS
PHP COOKIES AND SESSIONS
 
murach12.pptx
murach12.pptxmurach12.pptx
murach12.pptx
 
Ch4(saving state with cookies and query strings)
Ch4(saving state with cookies and query strings)Ch4(saving state with cookies and query strings)
Ch4(saving state with cookies and query strings)
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 

Cookies

  • 1.
  • 2.  Definition : Time span during which a browser interacts with particular server. Begins: When a browser becomes connected to a particular server. Ends: When browser ceases to be connected to that server coz: 1)Becomes connected to different server 2)Or it is Terminated
  • 3.  HTTP – STATELESS PROTOCOL  STATELESS- No means to store information about a session  USES: 1) Many web sites creates profiles of clients by remembering which parts of the site was pursued– ADVERTISEMENTS. 2) Server recognizes request from a client(who has made earlier requests) from same site– CUSTOMIZED INTERFACE.
  • 4. - Provides General Approach To Store information about SESSIONS on Browser Itself. - Created by some software system on server such as CGI program. (CGI- Protocol used between browser and software on server) - .
  • 5.  A text file which a website can store on its visitors‟ hard drives  Made up of numbers and letters  Generally, cookies are a simple ID file  Sometimes they can store more complicated information  Also called “name-value pairs”
  • 6.  Most Cookies store just 1 data value  A Cookie may not exceed 4 Kb in size  Browsers are preprogrammed to allow a total of 300 Cookies, after which automatic deletion based on expiry date and usage  Cookies have 3 key attributes: name, value and expiry date
  • 7.  Sites    use cookies to… Track number of visitors First timers vs. returning visitors How often the user visits the site  Why?   Frequent Buyer example $$$ from Advertisers
  • 8.  You can find cookie files on your hard drive, your “C” drive.
  • 9. 1)Stores info about msg. 2)Can Include 1 or more cookies HEADER MESSAGE Request SERVER BROWSER Response
  • 10. 1. User sends a request for page at www.example.com for the first time. page request
  • 11. 2. Server sends back the page xhtml to the browser AND stores some data in a cookie on the user‟s PC. xhtml cookie data
  • 12. 3. At the next page request for domain www.example.com, all cookie data associated with this domain is sent too. page request cookie data
  • 13. ANATOMY OF A (SIMPLE) COOKIE String of text with these attributes:  The domain and path for which the cookie is valid  The name of the cookie  The value of the cookie  The expiration date of the cookie  Whether a secure connection needed to use the cookie
  • 14.  Cookies allow servers to record browser activities, Hence considered as a privacy concern. Accordingly, browsers allow the client to change the browser setting to refuse to accept cookies from servers. Drawback- clients that reject them render them useless.
  • 15.  CGI.pm module includes support for cookies in Perl through cookie function.  Serves two tasks: 1) To Create a cookie 2) To retrieve existing cookies from HTTP header of a request.
  • 16.  Form of call is: cookie(-name => a_cookie_name, -value => a_value, -expires => a_time-value)
  • 17. cookie name- string value- scalar value, including references to arrays and hashes expires - specifies lifetime of a cookie, can be expressed in many different units. Example: +3d specifies 3 days s - seconds m - minutes h - hours M - months y - years now - right now -ve value - kills cookie
  • 18. Calling cookie function 1) Without parameters: Returns hash of all of the cookies in the HTTP header of current request. 2) To retrieve the value of 1 cookie, the cookie function is called with the name of the cookie. For ex: $age=cookie („age‟); Gets the value of cookie named age.
  • 19. Prog block To display all cookies(with both name and values) in a CGI prog use: print “Cookie Name t Cookie value <br/>”; foreach $name(keys cookie()) { print “$name t cookie($name) <br/>”; }
  • 20. In CGI.pm, A cookie is placed in the HTTP header when header function is called with cookie as a parameter passed to it as follows: header(-cookie => $my_cookie)
  • 21.  Calls time function – time returns current time in seconds since January 1,1970. Converts the number of seconds into nine values: 1)$sec - seconds 2)$min - minutes 3)$hour - hour 4)$mday - day of the month 5)$mon - month (coded as 0 to 11) 6)$year - number of years since 1900 7)$wday - day of week (coded as 0 to 6; 0-sunday) 8)$yday - day_of the year 9)$isdst - Boolean; specifies whether the given time is in daylight savings time 
  • 22. PROG TO DISPLAY ALL NINE VALUES RETURNED BY localtime: #time_date.pl #Input: None #Output: The nine values returned by localtime ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;
  • 23. print “$sec= $sec n”; print “$min= $minn”; print “$hour= $hour n”; print “$mday= $mday n”; print “$mon= $mon n”; print “$year= $year n”; print “$wday= $wdayn”; print “$yday= $yday n”; print “$isdst= $isdstn”;
  • 24. $sec = 43 $min = 20 $hour = 10 $mday =19 $mon = 2 $year = 105 $wday = 6 $yday = 77 $isdat = 0
  • 25.  For days of the week, we often prefer to get the names rather than numbers… this can be done in Perl as: $day_of_week=(qw(Sunday Monday Tuesday Wednesday Friday Saturday))[(localtime)[6]]; where subscript 6 is for $wday
  • 26. CGI PROG FOR CREATING GREETING FOR VISITORS: #!/usr/bin/perl # day_cookie.pl # A CGI program to use a cookie to remember the day of the last login from a user and display it when run Use CGI “:standard”;
  • 27. #>>> Get the existing day cookie, if there was one @last_day = cookie(„last_time‟); #>>> Get the current date and make the new #>>> cookie $day_of_week = (qw(Sunday Monday Tuesday Wednesday Friday Saturday))[(localtime)[6]]; $month=(qw(January February March April May June July August September October November December))[(localtime)[4]]; $day_of_month = (localtime)[3];
  • 28. @day_stuff = ($day_of_week, $day_of_month, $month); $day_cookie = cookie(-name => „last_time‟, -value => @day_stuff, -expires => „+5d‟); #>>> Produce the return document #>>> First, put the cookie in the new header print header(-cookie => $day_cookie); print start_html(„This is day_cookie.pl‟);
  • 29. #>>> If there was no day cookie, this is the first #>>> visit if(scalar(@last_day) == 0) { print “Welcome to you on your first visit to our site<br/>”; }
  • 30. #>>> Otherwise, Welcome the user back and give #>>> the date of the last visit else { ($day_of_week, $day_of_month, $month) = @last_day; print “Welcome back! <br/>”, “Your last visit was on “, “$day_of_week, $month $day_of_month <br/>”; } print end_html;
  • 31. OUTPUT Welcome back! Your last visit was on Friday,March 22
  • 32. MMMM! COOKIES…  They remember usernames for various sites that require log-in  Also have the option to remember your passwords for you!  They allow you to shop as you browse via online shopping carts!  Cookies provide user customization of sites, like weather.com & msn.com
  • 33. COOKIE SCOPE: CAN DO  Store and manipulate any information you explicitly provide to a site  Track your interaction with parent site such as pages visited, time of visits, number of visits  Use any information available to web server including: IP address, Operating System, Browser Type
  • 34. LIFE WITHOUT COOKIES…  Many sites are heavily dependent on cookies and may not function well without them  Some may not function at all  Erasing cookies prevents visitors from making use of certain amenities sites offer
  • 35. CONCLUSION  Cookies were originally created as harmless pieces of text for user convenience  Along the way, some evil geniuses found a way to exploit them for business  The paranoia arises from the invisible nature of cookie transactions and inadequate information about their ability.