this will ensure a file with .php extension will not be added:
foreach ($files as $file) {
if(!strstr($file,'.php')) $zip->addFile($file);
}
edit: here's the full code rewritten:
<?php
$zipname = 'adcs.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && !strstr($entry,'.php')) {
$zip->addFile($entry);
}
}
closedir($handle);
}
$zip->close();
header('Content-Type: application/zip');
header("Content-Disposition: attachment; filename='adcs.zip'");
header('Content-Length: ' . filesize($zipname));
header("Location: adcs.zip");
?>