ftp类(myftp.php)
作者:bea
<?phpclass myftp {var $connector;var $getback;function connect($ftp_server, $uname, $passwd){// Baut grundlegende FTP Connection auf$this->connector = @ftp_connect($ftp_server);$this->login_result = @ftp_login($this->connector,
<?php
class myftp {
var $connector;
var $getback;
function connect($ftp_server, $uname, $passwd){
// Baut grundlegende FTP Connection auf
$this->connector = @ftp_connect($ftp_server);
$this->login_result = @ftp_login($this->connector, "$uname", "$passwd");
if ((!$this->connector)
(!$this->login_result))
{
echo "FTP connection has failed!
";
echo "Attempted to connect to $ftp_server for user $uname
";
die;
} else {
echo "Connected to $ftp_server, for user $uname
";
}
}
function lastmodtime($value){
$getback = ftp_mdtm ($this->connector,$value);
return $getback;
}
function changedir($targetdir){
$getback = ftp_chdir($this->connector, $targetdir);
return $getback;
}
function getdir(){
$getback = ftp_pwd($this->connector);
return $getback;
}
function get_file_list($directory){
$getback = ftp_nlist($this->connector, $directory);
return $getback;
}
function get_file($file_to_get, $mode, $mode2){
$realfile = basename($file_to_get);
$filename = $realfile;
$checkdir = @$this->changedir($realfile);
if ($checkdir == TRUE){
ftp_cdup($this->connector);
echo "
[DIR] $realfile";
}else{
echo "..... ". $realfile ."
";
$getback = ftp_get($this->connector, $filename, $realfile, $mode);
if ($mode2){
$delstatus = ftp_delete($this->connector, $file_to_get);
if ($delstatus == TRUE){
echo "File $realfile on $host deleted
";
}
}
}
return $getback;
}
function mode($pasvmode){
$result = ftp_pasv($this->connector, $pasvmode);
}
function ftp_bye(){
ftp_quit($this->connector);
return $getback;
}
}
?>
猜你喜欢
您可能感兴趣的文章:
- 分页显示Oracle数据库记录的类之二
- 分页显示Oracle数据库记录的类之一
- 在线竞拍系统的PHP实现框架(一)
- 用在PHP里的JS打印函数
- 在PHP的图形函数中显示汉字
- PHP中在数据库中保存Checkbox数据(2)
- PHP中显示格式化的用户输入
- 提升PHP执行速度全攻略(下)
- PHP的面向对象编程
- PHP文本数据库的搜索方法
- PHP:风雨欲来 路在何方?
- 用Socket发送电子邮件(利用需要验证的SMTP服务器)
- 用PHP实现登陆验证码(类似条行码状)
- 用PHP创建PDF中文文档
- PHP与javascript对多项选择的处理
- 3
- example2.php
- 对盗链说再见...
- PHP出错界面