Public Member Functions | Data Fields
Cookie Class Reference

User cookie wrapper. More...

Public Member Functions

 Cookie ($name, $value=null, $expire=null, $path=null, $domain=null, $secure=null, $httponly=null)
 
 save ()
 
 delete ()
 

Data Fields

 $name
 
 $value
 
 $expire
 
 $path
 
 $domain
 
 $secure
 
 $httponly
 

Detailed Description

User cookie wrapper.

Version
1.2
Author
DinuSV

Member Function Documentation

Cookie (   $name,
  $value = null,
  $expire = null,
  $path = null,
  $domain = null,
  $secure = null,
  $httponly = null 
)

Constructor

Parameters
string$name: the name of the cookie
string$value[optional] : value of the cookie
integer$expire[optional] : time the cookie will expire
string$path[optional] : the path the server in which the cookie will be available on
string$domain[optional] : the domain the cookie is available to
boolean$secure[optional] : transmit the cookie through a secure https connection
boolean$httponly[optional] : make the cookie accessible only through the HTTP protocol
save ( )

Set the cookie with the setcookie function

Returns
boolean : false if output exists prior to calling this function, true if the cookie has been saved
delete ( )

Unset the cookie by calling the setcookie function

Returns
boolean : false if output exists prior to calling this function, true if the cookie has been saved

Field Documentation

$name

string : Name of the cookie

$value

string : Value of the cookie

$expire

int : Time the cookie expires in ( UNIX timestamp )

$path

string : The path on the server in which the cookie will be available on. Set to '/' to make it available through the entire domain.

$domain

string : The domain that the cookie will be available to.

$secure

bool : Transmit the cookie only if the connection is a secure HTTPS connection from the client. When set to true, the cookie will be set only if a secure connection exists.

$httponly

bool : The cookie will only be made accessible through the HTTP protocol. The cookie cannot be accessed through scripting languages, like javascript.