웹마스터 팁
page_full_width">
위 짜가리 클래스 활용 1 (FTP 디렉토리 트리뷰)
2002.06.24 19:02
http://www.sjbiz.net/house/study/ftpDir.php미리보기 : http://www.sjbiz.net/house/study/ftpDir.php
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// 활 용 예 제 ///////////////////////////////
////////////////////////////////////////////////////////////////////////////////
require("TreeView.php");
$tv=new TreeView(); //트리뷰 생성
$tv->setPos(50, 50);
$tv->setWidth("");
$tv->setToggleImg("img/add.gif|img/sub.gif|img/sub.gif");
$tv->setFont("333333|none,0000ff|underline");
function reDir($dir){
global $tv, $ftp, $PHP_SELF;
$aDir=ftp_nlist($ftp, $dir);
if(!$aDir) echo("<b>$dir File Given Failed..!!</b>");
else {
while(list(,$Key)=each($aDir)){
$str = substr(str_replace($dir."/", " ", $Key), 1);
if (-1==ftp_size($ftp, $Key)){
$tv->Add($Key, $str, "'$PHP_SELF' target='NEW'", $dir);
reDir($Key);
}
}
}
}
function makeDan($num){
if ($num>10000000) return number_format(round($num/10000000))."MBytes";
if ($num>1000) return number_format(round($num/1000))."KBytes";
else return $num."Bytes";
}
$uDir="/public_html/house/";
$ftp=ftp_connect("자신의 계정"); //수정 하세여..
ftp_login ($ftp, "계정 아이디", "계정 암호"); // 수정 하세여 ^^
$tv->Add($uDir, $uDir, "'$PHP_SELF'");
reDir($uDir);
ftp_quit($ftp);
$tv->Refresh();
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// 활 용 예 제 ///////////////////////////////
////////////////////////////////////////////////////////////////////////////////
require("TreeView.php");
$tv=new TreeView(); //트리뷰 생성
$tv->setPos(50, 50);
$tv->setWidth("");
$tv->setToggleImg("img/add.gif|img/sub.gif|img/sub.gif");
$tv->setFont("333333|none,0000ff|underline");
function reDir($dir){
global $tv, $ftp, $PHP_SELF;
$aDir=ftp_nlist($ftp, $dir);
if(!$aDir) echo("<b>$dir File Given Failed..!!</b>");
else {
while(list(,$Key)=each($aDir)){
$str = substr(str_replace($dir."/", " ", $Key), 1);
if (-1==ftp_size($ftp, $Key)){
$tv->Add($Key, $str, "'$PHP_SELF' target='NEW'", $dir);
reDir($Key);
}
}
}
}
function makeDan($num){
if ($num>10000000) return number_format(round($num/10000000))."MBytes";
if ($num>1000) return number_format(round($num/1000))."KBytes";
else return $num."Bytes";
}
$uDir="/public_html/house/";
$ftp=ftp_connect("자신의 계정"); //수정 하세여..
ftp_login ($ftp, "계정 아이디", "계정 암호"); // 수정 하세여 ^^
$tv->Add($uDir, $uDir, "'$PHP_SELF'");
reDir($uDir);
ftp_quit($ftp);
$tv->Refresh();