FTP Unzip Script


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
  2.  
  3. transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-UK">
  5. <head>
  6. <title>Billy's Unzipper Script</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8. <meta name="generator" content="thekid" />
  9. <meta name='robots' content='noindex,nofollow' />
  10. </head>
  11. <body>
  12. <?php
  13. $file = $_GET['file'];
  14. $removeorig = $_GET['removeorig'];
  15. $unzipper = $_GET['unzipper'];
  16. if (isset($file))
  17. {
  18. echo "Unzipping " . $file . "...<br />\n";
  19. system('unzip -o ' . $file);
  20. echo "<hr />\n";
  21. if (isset($removeorig)) {
  22. echo "Deleting Zip...<br />\n";
  23. unlink("$file");
  24. }
  25. }
  26. if (isset($unzipper)) {
  27. echo "Deleting Script...<br />\n";
  28. unlink(__FILE__);
  29. echo "Script Deleted!<br /><a href=\"/\">HOME</a>\n";
  30. }
  31. $handler = opendir(".");
  32. echo "Please choose a file to unzip: <br />\n";
  33. echo '<form action="" method="get">'."\n";
  34. $found = 0;
  35. while ($file = readdir($handler))
  36. {
  37. if(strrchr($file,".zip") != ".zip" ) { continue; }
  38. {
  39. echo '<input type="radio" name="file" value="' . $file . '"/> ' . $file . "<br />\n";
  40. $found = 1;
  41. }
  42. }
  43. echo '<hr/><input type="checkbox" name="removeorig" value="Remove" />Delete .zip after extraction?'."<br
  44.  
  45. />\n";
  46. echo '<input type="checkbox" name="unzipper" value="Remove" checked="checked" />Delete Unzipper Script?
  47.  
  48. (Uncheck this box if you have more files to unzip!)'."<br />\n";
  49. closedir($handler);
  50. if ($found == FALSE)
  51. echo "No .zips found<br />";
  52. else
  53. echo '<br />NOTE: This unzips and <strong>REPLACES</strong> files.<br /><br /><input type="submit"
  54.  
  55. value="Unzip!" />';
  56. echo "\n</form>";
  57. ?>
  58. <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10"
  59.  
  60. alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a></p>
  61. </body>
  62. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.