search engine optimization   Programming blog
        SEO        Link Building        Services        Genie Magic        Web Design        Contact Us        SEO Tools
 
   
How to use cookies in PHP, Saturday, May 17, 2008
   
 

Cookies in PHP is done by using the statement setcookie() , this statement is available from the time when version 3 of PHP.

int setcookie (string Name [, string Value [, int Expire [, string Path [, string Domain [, int Secure]]]]]);

setcookie() defines a cookie that is sent the information from the header. Cookies are sent before any html tag; therefore, we call one of these statements before any tag <html> or <head>. This is a restriction of cookies, not for PHP.

All messages, except the name are optional.
  • Name . Name of the cookie. If we create a cookie only with its name, the cookie name is existing in the Client under said name will be deleted. We can also replace to any argument with an empty string("").

  • Value . Value to be stored by the cookie in the Client.

  • Expire . The argument expire is an integer argument that indicates the time of the cookie will be deleted in the time format returned by the UNIX statements time() and mktime(). Time() + N seconds of duration is commonly used to specify the duration of the cookie.

  • Path . Subdirectory where the cookie has a value.

  • Domain . Domain where the cookie has a value. If we establish www.yourdomain.com as domain, the cookie is not set for domain.com. Meanwhile, if we establish yourdomain.com as domain, the cookie is set as for yourdomain.com as for www. yourdomain.com.

  • Secure . The secure indicates that the cookie will only be set by a secure HTTPS connection.

Example

setcookie("Ron", "Victor", time()+3600,"/","yahoo.com");

In this example, we set a user name cookie that has the value Victor , lasts 1 hour (3600 seconds) valid for the whole domain yahoo.com

                                Earthlink Netscape Netvouz RawSugar Shadows Sphinn StumbleUpon Yahoo MyWeb

 
   
 

posted by candy @ 12:27 AM permanent link   | Post a Comment |

 

0 Comments:

Post a Comment

Home

 

Categories
 

 
Archives
 
Previous posts
 
 
PageRank 10 sites
Search Engine Optimization SEO Blog
Search Engine
Optimization SEO News
SEO Copywriting Blog
Web Design Blog
Link Building Blog
Pay Per Click (PPC) Blog
Programming Blog
Search EngineGenie Blog
Lara's Personnal Blog
Search Engine
Optimization SEO Forum
SEO Comics
Webmaster & Search Events
 
search engine optimization
search engine marketing
SEO consulting
SEO plans
SEO services USA
search engine optimization SEO forum
SEO comics
Webmaster & Search Events
SEO Faqs
link popularity
strategies of link building
link building services
link cost
link request quote
link building blog
search engine genie company
our team
our celebrations
our experience
SEO
why us

web design
web designing services
dynamic website
web design and marketing
simple e-commerce website
complex e-commerce website
search engine friendly site
web design blog
web design
link building
internet marketing
ecommerce implementation
pay per click services
shopping feeds optimization
shopping cart customization
product development
online forms & database integration
programming services
PHP programming services
programming services Java,J2EE
.NET application development programming services
business process outsourcing
offshore outsourcing
Google Products(froogle feeds)
search engine optimization articles
google articles
yahoo articles
miscellenous articles
search engine optimization SEO blog
search engine optimization SEO news
SEO copywriting blog
web design blog
link building blog
pay per click (PPC) blog
programming blog
lara personnal blog
Search Engine Genie Blog
Google Tools
Yahoo Tools
MSN Tools
Comparison Tools
Link Popularity Tools
Search Engines Tools
Site Tools
Keyword tools

contact us
support
our guarantee
events