国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php 在線解壓程序

2024-05-04 23:06:28
字體:
來源:轉載
供稿:網友
  1. <?php 
  2. HtmlHead("選擇解壓文件:") ; 
  3.  
  4. if ( !IsSet($HTTP_POST_VARS['submit']) ) 
  5.  TestWriteable() ; 
  6.  $gzip_info = "" ; 
  7.  echo "check zlib support... " ; 
  8.  if ( !function_exists("gzopen") ) 
  9.  { 
  10.   $gzip_info = "<font color="red">注意! 您的空間沒有zlib支持,因此用 
  11.   <a href="http://www.survivalescaperooms.com/" target="_blank"><font color="blue">phpZip</font></a>  
  12.   壓縮文件時,不要選擇“壓縮成Gzip格式”,否則將無法正確解壓!</font>" ; 
  13.  } 
  14.  else 
  15.  { 
  16.   $gzip_info = "<font color="blue">恭喜! 您的空間支持zlib壓縮,強烈建議用  
  17.   <a href="http://www.survivalescaperooms.com/"><font color="red" target="_blank">phpZip</font></a>  
  18.   壓縮文件時,選中“壓縮成Gzip格式”,將會大大減少文件大小!</font>" ; 
  19.  } 
  20.  echo " ----------------- OK!<br> " . $gzip_info ; 
  21.   
  22.  echo "<br><br><br><br> 
  23. <form action="{$_SERVER["PHP_SELF"]}" method="post" enctype="multipart/form-data"
  24. <table align="center" width="450"
  25. <tr><td height="20" colspan="2">請先選擇壓縮文件的位置,然后點擊“確定”按鈕: <p></td></tr> 
  26. <tr> 
  27. <td><input type="radio" name="file_type" value="upload" checked onclick="this.form.upload_file.disabled=false; this.form.server_filename.disabled=true">文件從本地上傳: </td>  
  28. <td> 
  29. <input name="upload_file" type="file" style="color:#0000ff"
  30. </td> 
  31. </tr> 
  32.  
  33. <tr><td colspan=2 height=10></td></tr> 
  34.  
  35. <tr> 
  36. <td><input type="radio" name="file_type" value="server" onclick="this.form.upload_file.disabled=true; this.form.server_filename.disabled=false">指定服務器上文件:</td> 
  37. <td><input name="server_filename" value="data.dat.gz" style="color:#0000ff" disabled >(可以用"."表示當前目錄)</td> 
  38. </tr> 
  39.  
  40. <tr><td colspan="2" align=center><br><input type="submit" name="submit" value="確定"></td></tr> 
  41. </table> 
  42. </form> 
  43. " ; 
  44.  HtmlFoot() ; 
  45.  exit ; 
  46.  
  47. if ( $_POST['file_type'] == 'upload' ) 
  48.  $tmpfile = $_FILES['upload_file']['tmp_name'] ; 
  49. else 
  50.  $tmpfile = $_POST['server_filename'] ; 
  51.  
  52. if ( !$tmpfile ) 
  53.  exit("無效的文件或文件不存在,可能原因有文件大小太大,上傳失敗或沒有指定服務器端文件等") ;  
  54.  
  55. $bgzExist = FALSE ; 
  56. if ( function_exists("gzopen") ) 
  57.  $bgzExist = TRUE ; 
  58.  
  59. $alldata = "" ; 
  60. $pos = 0 ; 
  61.  
  62. $gzp = $bgzExist ? @gzopen($tmpfile"rb") : @fopen($tmpfile"rb") ; 
  63. $szReaded = "has" ; 
  64. while ( $szReaded ) 
  65.  $szReaded = $bgzExist ? @gzread($gzp, 2*1024*1024) : @fread($gzp, 2*1024*1024) ; 
  66.  $alldata .= $szReaded ; 
  67. $bgzExist ? @gzclose($gzp) : @fclose($gzp) ; 
  68.  
  69. $nFileCount = substr($alldata$pos, 16) ; 
  70. $pos += 16 ; 
  71.  
  72. $size = substr($alldata$pos, 16) ; 
  73. $pos += 16 ; 
  74.  
  75. $info = substr($alldata$pos$size-1) ;  // strip the last ' ' 
  76. $pos += $size ; 
  77.  
  78. $info_array = explode(" "$info) ; 
  79.  
  80. $c_file = 0 ; 
  81. $c_dir = 0 ; 
  82.  
  83. foreach ($info_array as $str_row
  84.  list($filename$attr) = explode("|"$str_row); 
  85.  if ( substr($attr,0,6) == "[/dir]" ) 
  86.  { 
  87.   echo "End of dir $filename<br>"
  88.   continue
  89.  } 
  90.   
  91.  if ( substr($attr,0,5)=="[dir]" ) 
  92.  { 
  93.   if ( @mkdir($filename, 0777) ) 
  94.    echo "Make dir $filename<br>"
  95.   $c_dir++ ; 
  96.  } 
  97.  else 
  98.  { 
  99.   $fp = @fopen($filename"wb"or exit("不能新建文件 $filename ,因為沒有寫權限,請修改權限"); 
  100.   @fwrite($fpsubstr($alldata$pos$attr) ); 
  101.   $pos += $attr ; 
  102.   fclose($fp); 
  103.   echo "Create file $filename<br>"
  104.   $c_file++ ; 
  105.  } 
  106.  
  107. if ( $_POST['file_type'] == 'upload' ) 
  108.  if ( @unlink($tmpfile) ) echo "刪除臨時文件 $tmpfile...<br>" ; 
  109.  
  110. echo "<h1>操作完畢! 共解出文件 $c_file 個, 文件夾 $c_dir 個,謝謝使用!</h1><p>" ; 
  111. HtmlFoot() ; 
  112.  
  113.  
  114. function TestWriteable() 
  115.  $safemode = ' 
  116. 新建一文件,命名為 unzip2.php (或其它名字), 其內容如下: 
  117.  
  118. <?php 
  119. copy("unzip.php""unzip_safe.php") ; 
  120. header("location:unzip_safe.php") ; 
  121. ?> 
  122.  
  123. 將這個文件上傳到服務器,與unzip.php同一個目錄下, 
  124. 運行 unzip2.php 這個程序。 
  125.  
  126. 如果還是不行的話,那就是空間實在不支持,沒有辦法,很對不住您,浪費您的時間. 
  127.  ' ; 
  128.  echo "check PHP version... " . phpversion() . " -------- OK!<br> " ; 
  129.  echo "testing Permission... " ; 
  130.  
  131.  $fp = @fopen("phpzip.test""wb") ; 
  132.  if ( FALSE !== $fp ) 
  133.  { 
  134.   fclose($fp) ; 
  135.   @unlink("phpzip.test") ; 
  136.  } 
  137.  else 
  138.  { 
  139.   exit("當前目錄沒有寫的權限,請將當前目錄屬性修改為:777 ") ; 
  140.  } 
  141.  
  142.  $dir = "phpziptest" ; 
  143.  $file = "$dir/test.txt.php" ; 
  144.  @mkdir($dir, 0777) ; 
  145.  $fp = @fopen($file"wb") ; 
  146.  if ( FALSE === $fp ) 
  147.  { 
  148.   @rmdir($dir) ; 
  149.   exit ("沒有權限在程序創建的文件夾下創建文件 ,很可能是PHP安全模式所致,解決方法如下:<p><center><textarea cols=110 rows=15>$safemode</textarea></center>") ; 
  150.  } 
  151.  @fclose($fp) ; 
  152.  @unlink($file) ; 
  153.  @rmdir($dir) ; 
  154.  echo " ----------------- OK!<br> " ; 
  155.  
  156. function HtmlHead($title=""$css教程_file=""
  157.  echo "<html> " 
  158.   . " " 
  159.   . "<head> " 
  160.   . "<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> " 
  161.   . "<title>$title</title> " 
  162.   . "<style type="text/css"> " 
  163.   . "body,pre,td {font-size:12px; background-color:#fcfcfc; font-family:Tahoma,verdana,Arial} " 
  164.   . "input,textarea{font-size:12px; background-color:#f0f0f0; font-family:Tahoma,verdana,Arial} " 
  165.   . "</style> " 
  166.   . "</head> " 
  167.   . " " 
  168.   . "<body> " ; 
  169.  
  170. function HtmlFoot() 
  171.  echo "<center><font size="5" face="楷體_GB2312" color="red">使用完請立即刪除本文件,以避免被其它人發現使用!</font></center> " 
  172.   . "<br><hr color="#003388"> " 
  173.   . "<center> " 
  174.   . "<p style="font-family:verdana; font-size:12px">Contact us: " 
  175.   . "<a href="http://www.survivalescaperooms.com/" target="_blank">http://www.survivalescaperooms.com/</a></p> " 
  176.   . "</center> " 
  177.   . "</body> " 
  178.   . " " 
  179.   . "</html>" ; 
  180. ?> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湘乡市| 武鸣县| 江山市| 毕节市| 乐昌市| 明水县| 浮梁县| 恩平市| 姜堰市| 新龙县| 永春县| 当阳市| 南充市| 华亭县| 广东省| 江阴市| 清河县| 达孜县| 溧水县| 松桃| 洛阳市| 磴口县| 监利县| 邻水| 黑龙江省| 广水市| 泾源县| 四平市| 积石山| 达孜县| 张掖市| 鹤庆县| 邵阳市| 新疆| 文登市| 朝阳区| 陇川县| 凉山| 曲靖市| 安国市| 宁德市|