How can PHP see client side cookies? -


how can php see client side cookies?

to elaborate: when working php & javascript, understand php gets processed on server side. while javascript happens on client side.

in javascript can check , set these client cookies. makes sense.

however, php, if check client cookie value part of conditional statement sets , how php able see clients cookie value while php happening on server side?

here's example of php conditional lives in php file:

<?php if ($_cookie["name"] == “mickey”) {     setcookie(“fulsome”, “mickey mouse”, time()+3600);   } ?> 

there no such thing client side cookie.

a cookie piece of data associated set of urls in browser. every time browser makes http request 1 of urls, cookie included in request headers.

they designed set via http response headers.

an api added browsers allows them created , set javascript. these still regular cookies though , included in every request associated urls.

it possible mark cookie http_only cause browsers prevent access cookie javascript. there no direct equivalent imposing similar limit going other way. closest come use local storage instead of cookies.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -