Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  Checksum  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: sample
Class: Checksum
Compute checksums of values passed by link URLs
Author: By
Last change: new sample
Date: 5 years ago
Size: 2,589 bytes
 

Contents

Class file image Download
<?php

function pdbg($data$color="orange"$Line=null$File=null$height=180$width=800) {
    
$dbg debug_backtrace();
    print 
"<div style=\"width:".$width."px;float:left;margin:5px\">";
    print 
"<div style=\"border:1px solid #999;font-size:11px;\">";
    print 
"<div style=\"background-color:".$color.";padding:2px 5px;font-weight:bold;border-bottom:1px solid #999;\">";
    print 
$File;
    if(
$Line) print', LINE: '.$Line.' ';
    
$offset = (isset($dbg[1])) ? 1:0;
    if(
$offset>0)
    print 
$dbg[$offset]["class"].$dbg[$offset]["type"].$dbg[$offset]["function"]."(".count$dbg[$offset]["args"]).")";
    print 
"</div>";
    print 
"<textarea style=\"width:100%;height:".$height."px;border:none;padding:0 0 0 5px;font-size:11px\">";
    
print_r($data);
    print 
"</textarea></div>";
    print 
"</div>";
}

ini_set("max_execution_time",3);

include_once(
"checksum.class.php");



// begin success
$checksum Checksum::build("Controller","list","asdsd");
$proof Checksum::proof($checksum,"Controller","list","asdsd");
pdbg($checksum"lime"__LINE__,__FILE__,20);
pdbg(($proof==true?"valid checksum":"invalid checksum"), "orange"__LINE__,__FILE__,20);
// end success



// begin time failure
$checksum Checksum::build("Controller","list","someParameter");
$proof Checksum::proof("aeeb089b00ab1d9934f1f065498c7497479cbd12","Controller","list","someParameter");
pdbg($checksum"lime"__LINE__,__FILE__,20);
pdbg(($proof==true?"valid checksum":"invalid checksum"), "orange"__LINE__,__FILE__,20);
// end time failure



// begin parameter failure
$checksum Checksum::build("Controller","list","someParameter");
$proof Checksum::proof($checksum,"Controller","list","somethingElse");
pdbg($checksum"lime"__LINE__,__FILE__,20);
pdbg(($proof==true?"valid checksum":"invalid checksum"), "orange"__LINE__,__FILE__,20);
// end time failure


// begin range
//Checksum::setTimestamp("2008-02-19");
//Checksum::setValidTimeRange(3600*24*665);
Checksum::isValidFromTo("2008-01-19","2009-03-19");
$checksum Checksum::build("Controller","list","asdsd");
pdbg($checksum"orange"__LINE__,__FILE__,20);
$proof Checksum::proof($checksum"Controller","list","asdsd");
pdbg($proof"orange"__LINE__,__FILE__,20);
// end range




// begin range failed
Checksum::isValidFromTo("2008-01-19","2009-01-19");
$checksum Checksum::build("Controller","list","asdsd");
pdbg($checksum"orange"__LINE__,__FILE__,20);
$proof Checksum::proof($checksum"Controller","list","asdsd");
pdbg($proof"orange"__LINE__,__FILE__,20);
// end range