????????????????????а?????Cookie????У?????????????????????????????????????????????????????????ж?????????????? cookies???????????????????ó??????????????????cookies???????????????????????????????????????????????????????????????????????

????GET and POST Data

????????cookies????????????????????????????????????????url?У??????????????????????·???С? ????????????????

????GET /index.php?foo=bar HTTP/1.1

????Host: example.org

??????????????????http get ??????get???????example.org?????????web ???????μ?index.php????? ??index.php????У????????$_GET['foo']??????????url??foo????????????’bar’???????php????????????????????GET???????????????????????????url??????????????????????????GET????????????HTTP GET??????????У???HTTP POST?????????????????????GET????????????GET??????????????url?м????????GET????????????????????????????

??????????????????????????????????????????????http???????????????? ????????????????????POST?????????????????

????POST /index.php HTTP/1.1

????Host: example.org

????Content-Type: application/x-www-form-urlencoded

????Content-Length: 7

????foo=bar

??????????????£?????index.php???????????$_POST['foo']???????????bar?????????????????POST???????????????form??post??????????????

??????????????У???????????????????????????

????POST /index.php?myget=foo HTTP/1.1

????Host: example.orgContent-Type: application/x-www-form-urlencoded

????Content-Length: 11

????mypost=bar

????????????????????????????cookies???????????????????cookie????????????????GET???POST?????????????????????????????????????PHPSESSID??????http?????url?У?????????????????

????GET /index.php?PHPSESSID=12345 HTTP/1.1

????Host: example.org

????????????????session id????????????cookie???????session id????????????Ч???? ?????????????????????????session id??????url?л????????????μ???????С?????cookie?????????????????????????cookie???????????????????????У????????????????й????cookie???????????????????php?????session.use_trans_sid?????????????session id ??????url??????????????????У????????????????????????????????????????????й?session id?? ?????е??????bookmark???url??????????url?????session id??????????????session id????й??????????????????????????????????????????session id?????????????????????????????????!

??????????POST??????????session id????????GET????????????????????????????????????鷳?????????????????????ó????б??????е??????????post?????????????????????

????Session?????

?????????????????????????????ó???????????????漰???????????????????????????????????????????????????????? - Session???????漰??session????????????????????????????????????????????????????????????????????????????????????????session??????????Щ????????????????????????????????????????????php?????session???????????? session??????????????/tmp??????????????????У????????е?session????????????浽????????$_SESSION?С???????????session??????????????session??????????洫??(????????????session id)?????????檔?????????????1?? start.php?? ?????????????????

????Listing 1 - start.php

????

????session_start();

????$_SESSION['foo'] = 'bar';

?????>

????continue.php

??????????????start.php?е????????continue.php???????continue.php?п??????$_SESSION['foo']?????start.php?е??????’bar’????????????????2:

????Listing 2: - continue.php

????

????session_start();

????echo $_SESSION['foo']; /* bar */

?????>

????????????????????????????????????????????д??????????????php???????session?????????????????????????????php??????????????????????????£????????????????????????????????????????????????????????????а????????

????Session??????????

?????????????????????php?????session???????????????????????????????session????????????????????????????php?????????????????Ч?????????????????????????ó???????????????? ???????????к????????????к???????????

????????????????????????????????session???????

???????????http://www.example.org??????????

????example.org?????????????????????????cookie - PHPSESSID=12345

?????????????????http://www.example.org/??????????????Я????????cookie - PHPSESSID=12345