Create a gzip file in PHP
This is a how-to on making a gzip file out of a text file with PHP. (alternate GNU gzip page.)
Make a file called compreport.php (or whatever you want) and put it this in it:
<?php // Name of the file we are compressing $srfile = "sourcefile.txt"; //Find out if the file exists do the thing if (file_exists($srfile)) { // Name of the gz file we are creating $gzfile = "compressedfile.gz"; // Open the gz file (w9 is the highest compression) $fpp = gzopen ($gzfile, 'w9'); // Compress the file gzwrite ($fpp, file_get_contents($srfile)); // Close the gz file and we are done gzclose($fpp); $varzfilename=$gzfile; echo $gzfile . ' file was generated! '; //create the file lastmod_varz.php //then uncomment the following line //include "lastmod_varz.php"; } //if source file is missing or has the wrong permissions! else { echo 'The source file ' . $srfile . ' does not exist!!! The compressed file ' . $gzfile . ' was not created or appended!'; } ?>
Make a file called lastmod_varz.php and put it wherever you put your include files. The lastmod_varz file should have this in it:
<?php $varzfile = $varzfilename; $last_modified = filemtime($varzfile); print("Last modified on "); print(date("m/j/Y" . " @ " . "h:i:s:a", $last_modified)); ?>
The lastmod_varz.php can be re-used wherever you want to show when the last modified time was for any file. Just assign the $varzfilename a value either a variable name or a quoted file name:
$varzfilename=$gzfile; OR $varzfilename="/reports/somefile.gz";
You could make all that an include page and put some styled <p class="coolpstyle"> tags around it.
If you would like some information on how to do something use the Contact Page. Someone will get back with you with an answer.