Unzipping files through php

The following script will unzip all files within the current directory and then print its results to the browser. To unzip a file, upload your .zip files and then upload this php file to the same directory and then visit this page in your browser. You could for example save this file as unzip.php and then upload it through FTP to /www.donotexec.com/web/content/ and then run it by visiting http://www.donotexec.com/unzip.php in your browser.

Happy coding!

$output = shell_exec('ls | grep .zip$ | while read line; do unzip `pwd`/$line; done 2>&1');
echo "<pre>$output</pre".">";
Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
No Comments Posted in php
Tagged , , ,

Leave a Reply


Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>