PHP is a web server scripting language (it is executed on the server side). It is mainly used for dynamic web sites.
The PHP variable $HTTP_REFERER gives information about where a visitor is coming from. Example :
This works only when the user has clicked on a href link (not entered the address in the address bar of his/her browser).
There is now a real use in this IFRAME :
tar is a file format initially used for tape archives, which is now commonly used and can be read by most archive programs (Winzip, PKzip,...).
Creating tar files is useful when proposing many files in a single download.
Here is a set of PHP functions which enable you to create tar files: tar.php.
Example of usage:
include("tar.php"); // the script provided on this site
$file_list = array("myfile.html", "pic01.jpg", "pic02.jpg"); // sample files
// call to the tar_c function which returns a string
// in the tar format
$contents = tar_c($file_list);
// header part which will tell the browser of which type the file is
header("Content-Disposition: attachment; filename=\"myfile.tar\"");
// sending the contents to the browser
This script enables the downloading of an HTML file and its pictures.
tar_c is defined in the tar.php part and creates a tar archive.
The used format is the one of the POSIX header (here on the GNU site) except that:
prefix part (which is 155 octet long) is not implemented (this is equivalent to the V7 TAR format)
- only regular files are supported
Others useful functions included in tar.php
tar_cf: create a tar file and save it to disk
tar_czf: create a compressed tar file and save it to disk