hello, thank your for the reply.
about the md5 i just copied this from another website, and i see that is working. but need some little modifications,
after reading a bit around i have added some things, below is the code :
PHP Code:
<?php
// Settings
$cachedir = 'cache2/'; // Directory to cache files in (keep outside web root)
$cachetime = 100; // Seconds to cache files for
$cacheext = 'html'; // Extension to give cached files (usually cache, htm, txt)
// Ignore List
$ignore_list = array(
'addedbytes.com/rss.php',
'addedbytes.com/search/'
);
// 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();
if (time() - $cachetime < $cachefile_created) {
//ob_start('ob_gzhandler');
echo gzuncompress(file_get_contents($cachefile));
//ob_end_flush();
exit();
} else {
if(file_exists($cachefile) && is_writable($cachefile)) unlink($cachefile);
}
// If we're still here, we need to generate a cache file
ob_start();
?>
AT THE END OF PAGE
PHP Code:
<?php
// 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, gzcompress(ob_get_contents(), 9));
@fclose($fp);
ob_end_flush();
?>
Is any thing wrong here ? i have added gzip function.. too.
Thank you for looking into this.
Best Regards
AvinD
Bookmarks