Zend - The PHP Company




Cookies

Add Code


Setting cookies for netscape  

Type: code fragment
Added by: smog
Entered: 16/03/2000
Last modified: 08/12/1999
Rating: **** (4 votes)
Views: 7160
A simples cookie setting script ONLY for Netscape browser.


<?
  
// By Jos� Afonso Santos aka smog
  // 
  // smog@kaotik.org
  // http://hero.kaotik.org/

  // Delete a cookie.
  
setCookie('name');

  
// Set a cookie to time out in 30 days (1 month).
  // Notice that the time parameter is measured in seconds.
  // Set a cookie's value.
  
setCookie('name''the-name-you-want'time()+2592000);

  
// Create a cookie that only scripts in the
  // private directory can read.
  
setCookie('country''the-country',
  
time()+2592000 '/private/');

  
// After the cookies are set, you can access them
  // using normal PHP variables.
  
echo "<center>Hello <b>$name</b> !</center>";
?>


Usage Example




Rate This Script





Search



This Category All Categories