<?php
    # set a cookie to expire in 1 hour with a user value of 'Joe Bloggs'
    setcookie("user", "Joe Bloggs", time()+3600);
?>
<html>
<body>
    <?php
    # check if user exist and if so print the value
    if (isset($_COOKIE["user"])) {
        echo "Welcome " . $_COOKIE["user"] . "!";
    }
    else {
        echo "Welcome guest!";
    }
    ?>
</body>
</html>
