PHP Classes

File: cookie.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  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: 14 years ago
Size: 319 bytes


Class file image Download
// 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) ;