这个类不安全,需要修改
getall();
$this->head();
$this->printarray($this->dir,目录);
$this->printarray($this->file,文件);
$this->foot();
}
//设置输出标题头
function head()
{
echo
table_w.' align=center>
.
www.litou.com 专用版 .
作 者: 叁 石
.
联系方式:
>sanshi0815@tom.com>.
  q q : 35047205
;
}
//设置结束尾
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).
;
//echo count($this->file).
;
//echo count($this->link).
;
}
//检查是否为目录
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_w.' align=center>;
echo enter.'>
;
foreach($array as $v)
{
$v=trim($v);
if(substr($v,0,1)!=.)
{
if($j%$this->enter==0)
{
echo
;
}
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 .$title..$v. ;
}
}
}
}}
?>