ftp类(myftp.php)

 更新时间:2006年10月09日 00:00:00   作者:  

<?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! \n";
                echo "Attempted to connect to $ftp_server for user $uname \n";
                die;
            } else {
                echo "Connected to $ftp_server, for user $uname \n";
            }
    }

    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 "\n[DIR] $realfile";
        }else{
            echo "..... ". $realfile ."\n";
            $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 \n";
                }
            }
        }
        return $getback;
    }

    function mode($pasvmode){
        $result = ftp_pasv($this->connector, $pasvmode);
    }

    function ftp_bye(){
        ftp_quit($this->connector);
        return $getback;
    }
}

?>

相关文章

  • php面向对象全攻略 (十) final static const关键字的使用

    php面向对象全攻略 (十) final static const关键字的使用

    这个关键字只能用来定义类和定义方法,不能使用final 这个关键字来定义成员属性,因为final 是常量的意思,我们在PHP 里定义常量使用的是define()函数,所以不能使用final 来定义成员属性。
    2009-09-09
  • PHP convert_uudecode()函数讲解

    PHP convert_uudecode()函数讲解

    今天小编就为大家分享一篇关于PHP convert_uudecode()函数讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2019-02-02
  • PHP简介

    PHP简介

    PHP简介...
    2006-10-10
  • PHP安全配置

    PHP安全配置

    PHP 作为一种强大的语言,无论是以模块还是 CGI的方式安装,它的解释器都可以在服务器上访问文件、运行命令以及创建网络连接等。这些功能也许会给服务器添加很多不安全因素,需要正确地安装和配置 PHP,以及编写安全的代码
    2006-10-10
  • cache_lite试用

    cache_lite试用

    cache_lite试用...
    2007-02-02
  • PHP get_html_translation_table()函数用法讲解

    PHP get_html_translation_table()函数用法讲解

    今天小编就为大家分享一篇关于PHP get_html_translation_table()函数用法讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2019-02-02
  • PHP脚本数据库功能详解(下)

    PHP脚本数据库功能详解(下)

    PHP脚本数据库功能详解(下)...
    2006-10-10
  • WHOIS类的修改版

    WHOIS类的修改版

    WHOIS类的修改版...
    2006-10-10
  • 一个颜色轮换的简单例子

    一个颜色轮换的简单例子

    一个颜色轮换的简单例子...
    2006-10-10
  • PHP 判断变量类型实现代码

    PHP 判断变量类型实现代码

    因为 PHP 会判断变量类型并在需要时进行转换(通常情况下),因此在某一时刻给定的变量是何种类型并不明显。
    2009-10-10

最新评论