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

首頁 > 開發 > PHP > 正文

http 協議下載類(自家用)

2024-05-04 23:05:21
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

這個類不安全,需要修改

<?php
/**
*httpdownload
*
*@author  sanshi
    qq:35047205
    email:[email protected]
    msn:[email protected]
*
*@version  1.0.0  2005/07/10
*
*@deprecated     
 1.http協議下載
 
*/
class httpdownload
{
 var $rootdom="d:/jsp/";//設定下載目錄,需要絕對路徑
 var $opendir;           //打開絕對的路徑
 var $open;    //將要打開的目錄
 var $enter=3;   //設置換行
 var $table_w=800;  //設置表格寬度
 var $div=array();     //設置目錄存放數組
 var $file=array();      //設置文件存放數組
 var $link=array();     //設置連接文件數組

 //構造函數
 function httpdownload()
 {
  $this->getall();
  $this->head();
  $this->printarray($this->dir,"目錄");
  $this->printarray($this->file,"文件");
  $this->foot();
 }
 //設置輸出標題頭
 function head()
 {
  echo "<table width='".$this->table_w."' align='center'><tr><td height='20%'>&nbsp;</td></tr><tr>".
    "<td align='center'><font size='8' color=''>www.litou.com 專用版</font></td>".
     "</tr><tr><td>作&nbsp;&nbsp;&nbsp;&nbsp;者:&nbsp;叁&nbsp;&nbsp;石</td></tr>".
      "<tr><td>聯系方式:[email protected]</td></tr>".
       "<tr><td>&nbsp&nbsp;q&nbsp;&nbsp;q&nbsp;&nbsp;:&nbsp;35047205</td></tr></table>";
 }
 //設置結束尾
 function foot()
 {

 }
 //取得將要打開的目錄
 function getopen()
 {
  $open=$_get["dir"];
  $this->open=$open;
  if(!isset($open)||empty($open))
  {
   $opendir=$this->rootdom;
  }else{
   $opendir=$this->rootdom.$open."/";
  }
  $this->opendir=$opendir;
  return $opendir;
 }

 //將目錄中的內容進行分檔
 function getall()
 {
  $opendir=$this->getopen();
  $handle=opendir($opendir);
  while($allfile=readdir($handle))
  {
   if(is_dir($opendir.$allfile))
   {
    $this->dir[]=$allfile;
   }else if(is_file($opendir.$allfile))
   {
    $this->file[]=$allfile;
   }else if(is_link($opendir.$allfile))
   {
    $this->link[]=$allfile;
   }
  }
  closedir($handle);
  //echo count($this->dir)."<br>";
  //echo count($this->file)."<br>";
  //echo count($this->link)."<br>";
 }
 //檢查是否為目錄
 function isdir($dir)
 {
  if(is_dir($dir))
  {
   return true;
  }
  return false;
 }
 //檢查是否為文件
 function isfile($file)
 {
  if(is_file($file))
  {
   return true;
  }
  return false;
 }
 //數組打印
 function printarray($array,$title)
 {
  $j=0;
  if(count($array)>0)
  {
   
   echo "<table width='".$this->table_w."' align='center'><tr>";
   echo "<td colspan='".$this->enter."'><hr></td></tr><tr>";
   foreach($array as $v)
   {
    $v=trim($v);
    if(substr($v,0,1)!=".")
    {
     
     if($j%$this->enter==0)
     {
      echo "</tr><tr>";
     }
     if(!isset($this->open)||empty($this->open))
     {
      $l="";
     }else{
      $l="/";
     }
     if($this->isdir($this->opendir.$v))
     {
      $url=$php_self."?dir=".$this->open.$l.$v;
      $color="#ff0033";
      $size="3";
     }else if($this->isfile($this->opendir.$v)){
      $url=$this->opendir.$v;
      $color="#0000ff";
      $size="5";
     }
     $j++;
     echo "<td><font size='".$size."' color='".$color."'>".$title."</font><a href='".$url."'>".$v."</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>";
    }
   }
   
  }
 }

}
?>
<?php
$do=new httpdownload();
?>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 饶河县| 黑水县| 奉化市| 和静县| 唐海县| 墨竹工卡县| 仁化县| 金寨县| 岫岩| 固镇县| 潞西市| 府谷县| 永善县| 科技| 花莲县| 古交市| 汉沽区| 博湖县| 全椒县| 甘德县| 塔城市| 夏邑县| 江安县| 南和县| 彭泽县| 长垣县| 若尔盖县| 大港区| 苏尼特左旗| 洞口县| 赤壁市| 和静县| 古浪县| 德化县| 化德县| 黔江区| 汨罗市| 宜章县| 宣恩县| 福州市| 兰溪市|