Cookies
Today you will learn how to store data in cookies.
Category: Coding
Views: 4340

Cookies Welcome to the cookies tutorial, today you will learn how to store data in cookies.

To use cookies you need to have a code at the top of your page.
Code:
ob_start();
?>

A basic cookie would look like this
Code:
setcookie('Name','value');
?>
That's a basic cookie, you can set time limits to cookies so they time out after an amount of time.
An example of this would be

Code:
setcookie('Name','Value',time() 3600);
?>
The cookie above will expire in 1 hour.

As for deleting a cookie you would set the expiration to a - number, so it would have expired by now.
Code:
setcookie('Name','Value',time()-3600);
?>
that sets the expiration date to 1 hour ago.

If you would like more help with this tutorial please register and visit the forum.

About Michael

Michael Dunlop Michael Dunlop personal statement

“But I am already older than 21”, I hear you cry. Don’t worry, despite the name, the information and advice is more geared towards retiring prior to having a fake hip installed.

Website Sponsors
Recommended Websites
They Buy, Build, Upgrade and Sell Websites.
 
Advertise Here
Feature Interviews
Graham went from $100 one day to ... Read more
Paul Bourque started affiliate marketing less than ... Read more
Interview with Yaro Starak of Entrepreneurs-Journey.com is ... Read more
Recommended Resources
 
 
 
 
 
Get Retire at 21's FREE Secrets
Find out how I'm going to Retire VERY Early Subscribe for my Free Secrets Privacy Guaranteed. 100% Spam free.