/* PURPOSE: This program prints the contents of a directory, allows users to select files, then ZIPs them and sends the ZIP file to the end user. REQUIRES: PHP 4+, Unix "zip" program. */ if ($FUNC == "GO") { // Make the command line. reset ($HTTP_GET_VARS); while (list ($key, $val) = each ($HTTP_GET_VARS)) { if ($key == "FUNC") continue; if ($val == "on") $cmdline .= " " . urldecode($key); } header ("Content-type: application/x-zip-compressed"); $cmdline = escapeshellcmd($cmdline); $t = popen ("/usr/bin/zip -D -j - $cmdline", "r"); if ($t === FALSE) { echo "Error"; } while (!feof ($t)) { $ch = fgetc($t); echo $ch; } pclose ($t); exit (); } $pos = strrpos ($PATH_TRANSLATED, "/"); if ($pos === false) { // note: three equal signs } else { $dirname = substr($PATH_TRANSLATED, 0, $pos); echo "