<?php
$starttime = microtime();
$startarray = explode(\" \", $starttime);
$starttime = $startarray[1] + $startarray[0];
// Settings
$cachedir = 'cache/'; // Directory to cache files in (keep outside web root)
$cachetime = 600; // Seconds to cache files for
$cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt)
// Ignore List
$ignore_list = array(
'domainname.co.uk/ignorethis.php',
'domainname.co.uk/ignorethisaswell.php'
);
// Script
$page = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; // Requested page
$cachefile = $cachedir . md5($page) . '.' . $cacheext; // Cache file to either load or create
$ignore_page = false;
for ($i = 0; $i < count($ignore_list); $i++) {
$ignore_page = (strpos($page, $ignore_list[$i]) !== false) ? true : $ignore_page;
}
$cachefile_created = ((@file_exists($cachefile)) and ($ignore_page === false)) ? @filemtime($cachefile) : 0;
@clearstatcache();
// Show file from cache if still valid
if (time() - $cachetime < $cachefile_created) {
ob_start('ob_gzhandler');
@readfile($cachefile);
ob_end_flush();
exit();
}
// If we're still here, we need to generate a cache file
ob_start();
?>
<?php
$endtime = microtime();
$endarray = explode(\" \", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,5);
echo \"<!-- This page took $totaltime seconds to generate -->\";
// Now the script has run, generate a new cache file
$fp = @fopen($cachefile, 'w');
// save the contents of output buffer to the file
@fwrite($fp, ob_get_contents());
@fclose($fp);
ob_end_flush();
?>

<? require('cache_header.php'); ?>
<?
//this is dynamic php
?>
<? require('cache_footer.php'); ?>It looks like you're new here. Click the social buttons to create your account or sign in.