Saxat från codinclick:
Now that you can retrieve cookies you can use them practically as checking if a user has logged in before and if so let them into the admin area, or instead show them the login form. This is extremely simple and the example below is very insecure for obvious reasons. It makes use of the header() function which allows many things such as browser redirection.
<?php
if($HTTP_COOKIE_VARS["username"] == "Bob") {
header("Location: admin.php");
} else {
header("Location: login.php");
}
?>
Är header redirect inte säkert ?