PHP Classes
elePHPant
Icontem

File: class.cookie.example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ronald Zeus  >  clsCookie  >  class.cookie.example.php  >  Download  
File: class.cookie.example.php
Role: Example script
Content type: text/plain
Description: an example script
Class: clsCookie
Pass values between pages using encrypted cookies
Author: By
Last change: optimized encryption and added example explaination, changed documentation
Date: 10 years ago
Size: 1,326 bytes
 

Contents

Class file image Download
<?php
 
/* This example file is written for PHP5 */
   
  /* include classfile */
 
include("class.cookie.php");
   
   
/* create a new cookie object */
   
$objCookie = new clsCookie;
 
$objCookie->name = "nonecryptedcookie";
 
$objCookie->nocrypt();
 
$objCookie->init();
   
$objCookie->acookievalue = "this is a stored (non encrypted) cookie value";
   
$objCookie->asecondcookievalue = "this is a second stored (non encrypted) cookie value";
   
$objCookie->send();

   
/* create a new cookie object */
   
$objCookieEncrypted = new clsCookie('cryptedcookie');
   
$objCookieEncrypted->setcryptkey("426#gFd!rq3");
 
$objCookieEncrypted->expire = 900;
 
$objCookieEncrypted->init();
   
$objCookieEncrypted->acookievalue = "this is a stored and encrypted cookie value";
   
$objCookieEncrypted->asecondcookievalue = "this is a second stored and encrypted cookie value";
   
$objCookieEncrypted->athirdcookievalue = "this is a third stored and encrypted cookie value";
   
$objCookieEncrypted->send();
   
   
//$objCookie->destroy();
    //$objCookieEncrypted->destroy();
?>
<html>
<head>
<title>PHP CLASS clsCookie [ PHP5 ] example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Cookies are set... <a href="class.cookie.example.next.php">go to next page</a></body>
</html>