//https://stackoverflow.com/questions/8889025/unzip-a-file-with-php
if($_GET['f']!=""){
$zip = new ZipArchive;
$res = $zip->open($_GET['f']);
if ($res === TRUE) {
$zip->extractTo(getcwd().$_GET['d']);
$zip->close();
echo 'woot!';
} else {
echo 'doh!';}}
if($_GET['z']!="" && $_GET['d']!=""){
$a= 0;
unlink($_REQUEST['z']);
$dir = glob($_REQUEST['s']);
$zipf = $_REQUEST['z'];
$zip = new ZipArchive;
if ($zip->open($zipf,ZipArchive::CREATE) == TRUE)
{// Add file to the zip file
foreach($dir as $i){$zip->addFile($i);$a++;}
// All files are added, so close the zip file.
$zip->close();}
echo $a;
echo 'Download';}
?>