Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Set/Get/Remove Cookies Jump to:  
Category: >> PHP Code >> Set/Get/Remove Cookies Bookmark and Share

<< lastnext >>

Snippet Name: Set/Get/Remove Cookies

Description: Examples of setting, getting, and removing cookies.

Also see:
» Delete all cookies set
» Cookie Login Code

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

/* Add Cookies */ 
SETCOOKIE ("TestCookie", $value); 
SETCOOKIE ("TestCookie", $value,TIME() 3600); /* expire in 1 hour */ 
SETCOOKIE ("TestCookie", $value,TIME() 3600, "/~rasmus/", ".utoronto.ca", 1); 
/* Remove Cookies */ 
// set the expiration date to one hour ago 
SETCOOKIE ("TestCookie", "", TIME() - 3600); 
SETCOOKIE ("TestCookie", "", TIME() - 3600, "/~rasmus/", ".utoronto.ca", 1); 
/* Use Cookies */ 
ECHO $TestCookie; 
ECHO $_COOKIE["TestCookie"]; 
/* Set cookie array */ 
SETCOOKIE ("cookie[three]", "cookiethree"); 
SETCOOKIE ("cookie[two]", "cookietwo"); 
SETCOOKIE ("cookie[one]", "cookieone"); 
     IF (ISSET ($cookie)) { 
          WHILE (LIST ($name, $value) = EACH ($cookie)) { 
          ECHO "$name == $value<br>\n"; 

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 189 users online    © 2009 psoug.org

Forgot your password?