Просмотр файла admin/backup/arch.php

Размер файла: 4.8Kb
  1. <?php
  2. include "../../head.php";
  3. echo '<link rel="stylesheet" href="../../style.css" type="text/css"/>';
  4.  
  5.  
  6.  
  7. $admin = $_POST['admin'];
  8. $password = $_POST['pass'];
  9. $email = $_POST['email'];
  10. $title = $_POST['title'];
  11. $index = $_POST['index'];
  12. $skin = $_POST['skin'];
  13. $mpass = md5($password);
  14.  
  15.  
  16.  
  17. error_reporting(7);
  18. include "tmp.php";
  19. class zipfile
  20. {
  21.  
  22. var $datasec = array();
  23. var $ctrl_dir = array();
  24. var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
  25. var $old_offset = 0;
  26.  
  27. function add_dir($name)
  28.  
  29. {
  30. $name = str_replace("\\", "/", $name);
  31.  
  32. $fr = "\x50\x4b\x03\x04";
  33. $fr .= "\x0a\x00";
  34. $fr .= "\x00\x00";
  35. $fr .= "\x00\x00";
  36. $fr .= "\x00\x00\x00\x00";
  37. $fr .= pack("V",0);
  38. $fr .= pack("V",0);
  39. $fr .= pack("V",0);
  40. $fr .= pack("v", strlen($name) );
  41. $fr .= pack("v", 0 );
  42. $fr .= $name;
  43. $fr .= pack("V",$crc);
  44. $fr .= pack("V",$c_len);
  45. $fr .= pack("V",$unc_len);
  46. $this -> datasec[] = $fr;
  47. $new_offset = strlen(implode("", $this->datasec));
  48. $cdrec = "\x50\x4b\x01\x02";
  49. $cdrec .="\x00\x00";
  50. $cdrec .="\x0a\x00";
  51. $cdrec .="\x00\x00";
  52. $cdrec .="\x00\x00";
  53. $cdrec .="\x00\x00\x00\x00";
  54. $cdrec .= pack("V",0);
  55. $cdrec .= pack("V",0);
  56. $cdrec .= pack("V",0);
  57. $cdrec .= pack("v", strlen($name) );
  58. $cdrec .= pack("v", 0 );
  59. $cdrec .= pack("v", 0 );
  60. $cdrec .= pack("v", 0 );
  61. $cdrec .= pack("v", 0 );
  62. $ext = "\x00\x00\x10\x00";
  63. $ext = "\xff\xff\xff\xff";
  64. $cdrec .= pack("V", 16 );
  65. $cdrec .= pack("V", $this -> old_offset );
  66. $this -> old_offset = $new_offset;
  67. $cdrec .= $name;
  68. $this -> ctrl_dir[] = $cdrec;
  69. }
  70.  
  71.  
  72. function add_file($data, $name)
  73. { $name = str_replace("\\", "/", $name);
  74. $fr = "\x50\x4b\x03\x04";
  75. $fr .= "\x14\x00";
  76. $fr .= "\x00\x00";
  77. $fr .= "\x08\x00";
  78. $fr .= "\x00\x00\x00\x00";
  79.  
  80. $unc_len = strlen($data);
  81. $crc = crc32($data);
  82. $zdata = gzcompress($data);
  83. $zdata = substr( substr($zdata, 0, strlen($zdata) - 4), 2);
  84. $c_len = strlen($zdata);
  85. $fr .= pack("V",$crc);
  86. $fr .= pack("V",$c_len);
  87. $fr .= pack("V",$unc_len);
  88. $fr .= pack("v", strlen($name) );
  89. $fr .= pack("v", 0 );
  90. $fr .= $name;
  91. $fr .= $zdata;
  92. $fr .= pack("V",$crc);
  93. $fr .= pack("V",$c_len);
  94. $fr .= pack("V",$unc_len);
  95. $this -> datasec[] = $fr;
  96. $new_offset = strlen(implode("", $this->datasec));
  97. $cdrec = "\x50\x4b\x01\x02";
  98. $cdrec .="\x00\x00";
  99. $cdrec .="\x14\x00";
  100. $cdrec .="\x00\x00";
  101. $cdrec .="\x08\x00";
  102. $cdrec .="\x00\x00\x00\x00";
  103. $cdrec .= pack("V",$crc);
  104. $cdrec .= pack("V",$c_len);
  105. $cdrec .= pack("V",$unc_len);
  106. $cdrec .= pack("v", strlen($name) );
  107. $cdrec .= pack("v", 0 );
  108. $cdrec .= pack("v", 0 );
  109. $cdrec .= pack("v", 0 );
  110. $cdrec .= pack("v", 0 );
  111. $cdrec .= pack("V", 32 );
  112.  
  113. $cdrec .= pack("V", $this -> old_offset );
  114. $this -> old_offset = $new_offset;
  115.  
  116. $cdrec .= $name;
  117. $this -> ctrl_dir[] = $cdrec;
  118. }
  119.  
  120. function file() {
  121. $data = implode("", $this -> datasec);
  122. $ctrldir = implode("", $this -> ctrl_dir);
  123. return
  124. $data.
  125. $ctrldir.
  126. $this -> eof_ctrl_dir.
  127. pack("v", sizeof($this -> ctrl_dir)).
  128. pack("v", sizeof($this -> ctrl_dir)).
  129. pack("V", strlen($ctrldir)).
  130. pack("V", strlen($data)).
  131. "\x00\x00"; }}
  132. $abort = ignore_user_abort(1);
  133. $zipfile = new zipfile();
  134. $fdir = opendir($dir);
  135. while($file = readdir($fdir)){
  136. if ($file != '.' and $file != '..'){
  137. if (is_file($dir.$file)){$zipfile->add_file(file_get_contents($dir.$file),$file);}
  138. if (is_dir($dir.$file)){
  139. $sdir = opendir($dir.$file);
  140. while($sfile = readdir($sdir)){
  141. if ($sfile != '.' and $sfile != '..'){
  142. if (is_file($dir.$file.'/'.$sfile)){$zipfile->add_file(file_get_contents($dir.$file.'/'.$sfile), $file.'/'.$sfile);}}}}}}
  143. $fil = fopen ("$zipdir/$zipp","r+");
  144. $str = $zipfile->file();
  145. if ( !$fil )
  146. {
  147. echo("Не получилось!:(");
  148. }
  149. else
  150. {
  151. fputs ( $fil, $str);
  152. }
  153. fclose ($fil);
  154. echo "Ураа!Получилось!<a href=\"index.php\">Создать Еще!</a>";
  155.  
  156. echo '<BR><a href="../index.php">Админка</a><BR>
  157. <a href="../../index.php">На главную</a>';
  158.  
  159. include "../../foot_admin.php";
  160.  
  161. ?>