Skip to content

Instantly share code, notes, and snippets.

@luissquall
Created February 12, 2016 05:14
Show Gist options
  • Save luissquall/c4305e167fd8643a8443 to your computer and use it in GitHub Desktop.
Save luissquall/c4305e167fd8643a8443 to your computer and use it in GitHub Desktop.
<?php
/*
echo Tiago > monos
zip --password 1234 monos.zip monos
#unzip -P 1234 monos.zip -d unzipped
chgrp www .
chmod g+w .
*/
$bin = shell_exec('which unzip');
if ($bin) {
$bin = trim($bin);
$cwd = __DIR__;
$password = '1234';
$file = $cwd . '/monos.zip';
$dir = $cwd . '/unzipped';
$cmd = "$bin -P 1234 $file -d $dir";
exec($cmd, $output, $status);
// print_r($cmd);
// var_dump($output);
if ($status === 0) {
echo "Content unzipped";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment