1 Technologies for managing state Passing session through URLs - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 Technologies for managing state Passing session through URLs - - PDF document

Administrivia !"#$" "%&'#(


slide-1
SLIDE 1

1

  • Administrivia

!"#$"

"%&'#(

)(('#(

*+,

(('#(##

  • ./

0/(/#1+

%234%&33

Today

*5 0/#

State management

'5-,6'',

  • /,

074, (*55--()

*/*--,/

*-8

2*--,/- 2**

HTTP is stateless Levels of state management

  • -,/

$))/0,,)0 7//#9/(

7

2**- ,/065--9),,#) 7/,(*

slide-2
SLIDE 2

2

Technologies for managing state

74- :+

Passing session through URLs

/67,,-;*

(*5#<( 5-8

,#6#74

)-

=5)>?,+;5,8#">=8-5- /5 @A4$7$'B<#"<CD8E?E+1=FE

55((((,,

,+

Using forms

G,#/-(5((-#

  • =)/>?,+;-5-?E

=-#->?5((?>?#"? 0,#>?=8-5- /5@A4$7$'B?#"?CD 8E?FE H =-#->?#?0,#>?1-?FE =F)E

What value to use?

55#,(*-#5#

,(8

76#/-(*59/-( *(65#,(<-(#(

%0,#-(574/

  • (*55#

//+5())/#,)+

4("(0 ((0)/5- '- ",,*)-()

Using URL parameters

%(0

+0*5 '/5/,,-, ://(/,I(BJC

(0I(BC

"(0

:0*(,(# #*,,,+#) )#/,**(*

Cookies

%/+-/)15(5

***

5*-/)/*0 2*-)/+50,

:,#(#)

(0(#,*(()5,

:))#/-

#/ %# %#0,# $1-(()#,9*5*/,!

slide-3
SLIDE 3

3

What cookies can do

(

)9-0(95--/

'/+#*50#*

%5"9(, $0*5#,

%,,*#-,K5

1-/

9*

How cookies work The messy details

0(;/(/+''

  • ''FL;

:I56LM :I'-61F5, "6'#9M0L6L6NO' $1-6'#9M0L6L6PNO' I:+6(>LP =5,E;;;=F5,E

2*/+,/, 5*0(9-/+

/+

O$'F(1;-5- ''FL; :/6Q-I%,0 :+6(>LP 6***;;/ 4)65-6FF***;;/F

Using cookies with PHP

/+*5

/+90,#9B1-9-59(9 /#,C!

40/+*5@A:Q$B?/+?C

FF)/+ )3@A:Q$B?/,?C!R FF/+,#,/#-,#!( /+?/,?9??9!STMTMT!D U

5-6FF#;-5-;F/+

Using cookies in JavaScript

$1/+/0*(

*

:+/,*(

(J0/- 5-6FF***;V#+(;F.F/+ ;5,

Using cookies

%(0

$ :#(/,I (0I ( %+*,(,#5/,0*5

(

/*

"(0

:,1 :+,#-/KBW+C ,(555 ##/+))5* 7,K/+

slide-4
SLIDE 4

4

Third-party cookies

,9/+,(

5*55

*09*0

  • 0(/)#,-,

%()(0/

'55(I-?/+?!/+

//#5#50,

Third-party cookie example

(0 55#(I); #/;/3

Session management with PHP

  • 0(/,)

*

:/50,/,#(

  • ,./!#<

:00,- G,,#,*/,(

7(555(

/(" ("#/+ "(0,0I(1

),

Creating a PHP session

7A!

)(0,#1905

(0,#@A$

FF,( A!D FF/5/+)0,?/,? FF)9 )3@A$B?/,?C!R @A$B?/,?C>?0,,?D U

Ending a PHP session

)**0(

FF/,5$ * @A$>!D FF/,,A(!(,), A(!D