TechiWarehouse.Com


Top 3 Products & Services

1.
2.
3.

Dated: Sep. 25, 2005

Related Categories

PHP Programming

By Najmi

Cookies are small bits of information that can be stored on a client computer. Once a cookie is created, it will expire after a specified time period. All the information stored in a cookie exists until it expires or deleted by the user.

Now-a-days most of the websites use cookies to store small amounts of information. Websites can read the values from the cookies and use the information as desired. The browser is capable of keeping track of the websites and their corresponding cookies and is capable of reading the information from relevant cookies.

How To Create a Cookie

Cookies can be set using the 'setcookie' function in PHP. This function takes three arguments - name of the variable, value of the variable and the expiry time period. The syntax to set a cookie using PHP is as given below:

 

Syntax:

setcookie("variable","value","time");

  1. variable - name of the cookie variable
  2. variable - value of the cookie variable
  3. time - expiry time

 

Example:

setcookie("Test",$i,time()+3600);

  1. Test - cookie variable name
  2. $i - value of the variable 'Test'
  3. time()+3600- denotes that the cookie will expire after an one hour

How To Reset/Destroy a Cookie

Using Cookies in PHP

There are several ways to destroy cookies. Cookies can be deleted either by the client or by the server. Clients can easily delete the cookies by locating the Cookies folder on their system and deleting them. The Server can delete the cookies in two ways:

  • Reset a cookie by specifying expiry time
  • Reset a cookie by specifying its name only

  Page 1 of 2
  First | Previous | Next | Last

Now that you've gotten free know-how on this topic, try to grow your skills even faster with online video training. Then finally, put these skills to the test and make a name for yourself by offering these skills to others by becoming a freelancer. There are literally 2000+ new projects that are posted every single freakin' day, no lie!


Previous Article

Next Article


Igor's Comment
You could try networks, stiitstacs, hardware. Not all programming is as bad as what you play with in CS, from what I have been told. My degrees are in Networking and Information Technology. Cheer up EE have it much worse. I know not much comfort its like telling someone being stabbed that being shot is worse, both are fatal. What about the programming don't you like ? What got you interested in computers in the first place ? What do you still like about computers now ? Also, I recommend a break, travel a little bit, either road trip or plane or something just to clear your head. Take the summer off, just a week and head to a beach and do nothing or take an inexpensive backpacking trip and see the outdoors and smell fresh air you have been stuck inside too long. Also, try volunteering its good for the heart and head to help others. Yip, I know a suggest it a lot, but it does do good. There are so many people out there afraid of computers that it makes me proud when I help someone at my college/university overcome there fear of computers. Now for people that have a general dislike of them well I can never do anything with that.However, I agree programming is not my cup of tea either. Good luck and try some other classes like art, or exercise and get out and breath you will be alright. Was this answer helpful?
24 Thu Jan 2013
Admin's Reply:



Aourongajab Abir's Comment
Thanks!!
28 Mon Nov 2011
Admin's Reply:

 you are welcome Aourongajab




azae's Comment
eee fdsf sdf dsdf dgdf
02 Tue Feb 2010
Admin's Reply:

Ok