home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / src / PHP / chips.php3.txt < prev    next >
Encoding:
Text File  |  2002-05-06  |  2.4 KB  |  109 lines

  1. Chips Class 
  2.  
  3. With this class you can use cookies with chips
  4.  
  5.  
  6.  
  7. --------------------------------------------------------------------------------
  8. <?php  
  9.      
  10. //  --------------------------------------------------------- 
  11. //   M≤dulo : chips.inc ( clase REF )  
  12. //   Autor  : Jorge Renato Machin Ibarra  
  13. //   Inicio : Diciembre 9 de 1998  
  14. //   Final  : Diciembre 9 de 1998        
  15. //   Dedicatoria : A Cecilia y Regina ┐pues a quienes mas? 
  16. //  --------------------------------------------------------- 
  17.  
  18. function getChips( $ChpName ) { 
  19.  
  20.    global $$ChpName; 
  21.  
  22.    $vals = split(  "&", $$ChpName ); 
  23.  
  24.    while( list ( $key, $val ) = each( $vals ) ) { 
  25.  
  26.       list( $ChpName, $wert ) = split(  "=", $val ); 
  27.  
  28.        if ( $val ) { 
  29.           
  30.           global $$ChpName; 
  31.  
  32.           eval(  "\$$ChpName = urldecode(\"$wert\");" ); 
  33.  
  34.        } 
  35.  
  36.    } 
  37.  
  38.  
  39.  
  40. class CHIPS { 
  41.  
  42.       var $Arr;  
  43.  
  44.       function setChips( $CookieVar0 =  "COOKIE-NULL", $CookieVar1 =  "COOKIE-NULL",   
  45.                          $CookieVar2 =  "COOKIE-NULL", $CookieVar3 =  "COOKIE-NULL",  
  46.                          $CookieVar4 =  "COOKIE-NULL", $CookieVar5 =  "COOKIE-NULL",  
  47.                          $CookieVar6 =  "COOKIE-NULL", $CookieVar7 =  "COOKIE-NULL",  
  48.                          $CookieVar8 =  "COOKIE-NULL", $CookieVar9 =  "COOKIE-NULL" )   
  49.       {  
  50.  
  51.          $curr =  "CookieVar0";           
  52.  
  53.          for ( $i = 0 ; $i < 10 && $$curr !=  "COOKIE-NULL"; $i++, $curr =  "CookieVar".$i ) { 
  54.       
  55.             $this->Arr[] = $$curr; 
  56.  
  57.          } 
  58.  
  59.       } 
  60.  
  61.  
  62.       function getParams() { 
  63.  
  64.           //  Declara las variables globales: 
  65.  
  66.          if ( empty ( $this -> Arr ) )  
  67.  
  68.             $elements = 0; 
  69.  
  70.          else  
  71.  
  72.             $elements = count( $this -> Arr ); 
  73.  
  74.          for( $i = 0; $i < $elements; $i++ ) { 
  75.  
  76.             $CookieVar = $this -> Arr[$i]; 
  77.  
  78.             global $$CookieVar; 
  79.  
  80.             if ( $$CookieVar !=  "" ) { 
  81.  
  82.                if ( $param !=  "" ) 
  83.  
  84.                   $param .=  "&"; 
  85.  
  86.                $param .= $CookieVar .  "=" . urlencode( $$CookieVar ); 
  87.  
  88.             } 
  89.  
  90.          } 
  91.  
  92.          return $param; 
  93.  
  94.       } 
  95.  
  96.       
  97.       function createCookie( $name, $min ) { 
  98.  
  99.          $value = $this -> getParams(); 
  100.  
  101.          SetCookie( $name,  $value,  time()+ ( $min * 60 ),   "/",   "",  0  );  
  102.  
  103.       } 
  104.  
  105. }; 
  106.  
  107. ?>
  108.