PHP Classes

File: cookie.php

Recommend this page to a friend!
  Classes of Carlos Falo Hervás   basic_basket   cookie.php   Download  
File: cookie.php
Role: Application script
Content type: text/plain
Description: Example code to generate the sessionID cookie
Class: basic_basket
Basic Shopping basket system
Author: By
Last change:
Date: 23 years ago
Size: 319 bytes
 

Contents

Class file image Download
<?PHP
// Generation of SESSION ID (cookie based)
// Cookie will last for 3 hours, enough for any simple purchase
// This is just an example of how it can be done

 
if (!$sessionID)
    {
   
$sessionID = uniqid("") ;
   
$expires = time() + 3*3600 ;
   
setcookie("sessionID",$sessionID,$expires) ;
    }
?>