Luke DS Luke DS - 9 months ago 50
PHP Question

How can php access cookies if cookies are stored on user computer

According to w3school "Cookies are data, stored in small text files, on your computer."

If that is true how can PHP access cookies, since PHP is execute in the server side?

Answer Source

The browser (Chrome/Firefox etc) of the user will physically look up the cookie on the local computer and send the data to the PHP server.

The PHP server never gets access to the users computer - rather the users computer presents the data requested.

Further reading: This is why cookies are not always great for security as it's up to the users computer to send them, and thus any computer can create their own cookies and send them pretending to be another user if they have access to another users cookies (Via open wifi network snooping etc).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download