Added: Apr 17, 2002
Snippet uploaded by: snippet
Written By: smog
Demo: Sorry, no demo
Another way to set a cookie in php. it also includes a date function for a time frame of a year.
// By JosÃƒÂ© Afonso Santos aka smog
// Delete a cookie.
// Getting the current date
$hour = date("H:i:s");
$year = date("y");
$year++; // Adding one year to the current year
$day = date("d-M-") . $year
$day_off_the_week = date("l");
// Setting the validation of the cookie up to one year.
$validation = $day_off_the_week . ", " . $day . " " .
$hour . " GMT";
// Set a cookie's value.
// Create a cookie that only scripts in the
// private directory can read.
// After the cookies are set, you can access them
// using normal PHP variables.
echo "<center>Hello <b>$name</b> !</center>";
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.