iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 22, 2008
How to Create an Ajax Autocomplete Text Field: Part 7
WebReference.com
 
May 22, 2008
Poll: Have you taken formal Web design, HTML, or CSS classes?
About
 
May 21, 2008
Rails For Beginners: All You Need To Know!
SitePoint
 
May 21, 2008
Web Host Reviews - 18 New Reviews
About
 
May 21, 2008
Pop-up Checkbox Navbar
EarthWeb.com
 
May 20, 2008
Write valid XML by writing your own schemas
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /PHP /Cookies and Sessions

PHP's Cookie handeling functions 

  Views:    17358
  Votes:    0
by Martyn Coupland 5/06/04 Rating: 

Synopsis:

Get to grips with the basics of PHP's Cookie handeling functions with this tutorial.
Pages: firstback2 forwardlast
The Article

Introduction

Welcome to my first article for DevPapers. This tutorial will show you the basics of PHP's cookie functions. I will cover main points such as setting cookies, printing cookie values and removing a cookie.

Let's Get Eating!

As you know PHP uses functions to perform tasks. For cookie setting PHP uses the setcookie() function. Below is the syntax for setting a cookie in PHP.

setcookie ( name [, value [, expire [, path [, domain [, secure]]]]])

If this is your first time with PHP then the syntax may be confusing. Let me explain what we have up there. The name attribute of the function allows you to set the name of the cookie, this will make it possible to print out a cookie value later in this tutorial. The value attribute is the information which will be stored on the clients computer. The expire attribute is the time at which the cookie will expire and information held in the cookie will no longer be used. If this is not set then the cookie will expire when the browser closes. The path attribute is the path on the server which the cookie will be available on. Domain refers to the domain name on which the cookie is available, and finally the secure attribute (either 0 or 1) shows if the cookie should only be used over a secure (https) connection.

Pages: firstback2 forwardlast

Similar/related articles:


 
  Sponsors