Creating a cookie

Cookies are small items that can be written on the hard disk of a client computer. In Google Chrome, these cookies can be found in a binary file. I found this file in “C:\Users\tmaanen.CORP\AppData\Local\Google\Chrome\User Data\Default\Cookies”.
These files can be written on request of the webserver. I wrote a small PHP programme that writes these cookies on the hard disk of the client. The programme reads as:

?php
setcookie("cookie[three]", "cookiethree", time() + 1000);
setcookie("cookie[two]", "cookietwo", time() + 1000);
setcookie("cookie[one]", "cookieone", time() + 1000);
echo "Cookie is set - disappears in 1000secs\n";    
?

When this programme was executes on the webserver, a cookie is sent to client computer. There, it can be seen in the options screen that displays cookies:
Chrome display of cookies

Once these cookies are stored on the hard disk, we could read them with a programme that is stored on the webserver. An example is given here:

if (isset($_COOKIE['cookie'])) {
    foreach ($_COOKIE['cookie'] as $name => $value) {
        $name = htmlspecialchars($name);
        $value = htmlspecialchars($value);
        echo "$name : $value 
\n"; } };

This PHP programme is executed on request from the client computer. This gives a screen like:

Return Cookies