当前位置: 首页>>代码示例>>PHP>>正文


PHP ftp_quit函数代码示例

本文整理汇总了PHP中ftp_quit函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_quit函数的具体用法?PHP ftp_quit怎么用?PHP ftp_quit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ftp_quit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CloseFtp

 function CloseFtp()
 {
     global $g_ftpLink;
     if ($g_ftpLink) {
         @ftp_quit($g_ftpLink);
     }
 }
开发者ID:ahmatjan,项目名称:cmf2,代码行数:7,代码来源:file.helper.php

示例2: ftp_file

/**
* FTP File to Location
*/
function ftp_file($source_file, $dest_file, $mimetype, $disable_error_mode = false)
{
    global $config, $lang, $error, $error_msg;
    $conn_id = attach_init_ftp();
    // Binary or Ascii ?
    $mode = FTP_BINARY;
    if (preg_match("/text/i", $mimetype) || preg_match("/html/i", $mimetype)) {
        $mode = FTP_ASCII;
    }
    $res = @ftp_put($conn_id, $dest_file, $source_file, $mode);
    if (!$res && !$disable_error_mode) {
        $error = true;
        if (!empty($error_msg)) {
            $error_msg .= '<br />';
        }
        $error_msg = sprintf($lang['Ftp_error_upload'], $config['ftp_path']) . '<br />';
        @ftp_quit($conn_id);
        return false;
    }
    if (!$res) {
        return false;
    }
    @ftp_site($conn_id, 'CHMOD 0644 ' . $dest_file);
    @ftp_quit($conn_id);
    return true;
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:29,代码来源:functions_posting.php

示例3: disconnect

 function disconnect()
 {
     if ($this->socket) {
         @ftp_quit($this->socket);
         $this->FtpAccess();
     }
 }
开发者ID:BackupTheBerlios,项目名称:swora,代码行数:7,代码来源:class.ftp.php

示例4: enviaImagen

function enviaImagen($fRutaImagen, $fDirServ, $fNombreImagen)
{
    $host = 'ftp.laraandalucia.com';
    $usuario = 'laraandalucia.com';
    $pass = '2525232';
    $errorFtp = 'no';
    $dirServ = 'html/images/Lara/' . $fDirServ;
    $conexion = @ftp_connect($host);
    if ($conexion) {
        if (@ftp_login($conexion, $usuario, $pass)) {
            if (!@ftp_chdir($conexion, $dirServ)) {
                if (!@ftp_mkdir($conexion, $dirServ)) {
                    $errorFtp = 'si';
                }
            }
        } else {
            $errorFtp = 'si';
        }
    } else {
        $errorFtp = 'si';
    }
    if ($errorFtp = 'no') {
        @ftp_chdir($conexion, $dirServ);
        if (@(!ftp_put($conexion, $fNombreImagen, $fRutaImagen, FTP_BINARY))) {
            $errorFtp = 'si';
        }
    }
    @ftp_quit($conexion);
    return $errorFtp == 'no';
}
开发者ID:amarser,项目名称:cmi,代码行数:30,代码来源:ManchaLlana.php

示例5: close

 /**
  * Closes the session
  */
 public function close()
 {
     $success = @ftp_quit($this->handle);
     
     if( !$success )
         throw new cFTP_Exception("Could not disconnect", 2);
 }
开发者ID:robik,项目名称:cFTP,代码行数:10,代码来源:Session.php

示例6: __destruct

    public function __destruct ()
	{
		if($this->stream!==null) {
			ftp_quit($this->stream);
		}
        $this->stream = null;
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:7,代码来源:Ftp.php

示例7: _authenticate

 /**
  * Find out if a set of login credentials are valid.
  *
  * @param string $userId      The userId to check.
  * @param array $credentials  An array of login credentials. For FTP,
  *                            this must contain a password entry.
  *
  * @throws Horde_Auth_Exception
  */
 protected function _authenticate($userId, $credentials)
 {
     $ftp = @ftp_connect($this->_params['hostspec'], $this->_params['port']);
     $res = $ftp && @ftp_login($ftp, $userId, $credentials['password']);
     @ftp_quit($ftp);
     if ($res) {
         throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
     }
 }
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:Ftp.php

示例8: ObtenerRuta

function ObtenerRuta()
{
    //Obriene ruta del directorio del Servidor FTP (Comando PWD)
    $id_ftp = ConectarFTP();
    //Obtiene un manejador y se conecta al Servidor FTP
    $Directorio = ftp_pwd($id_ftp);
    //Devuelve ruta
    ftp_quit($id_ftp);
    //Cierra la conexion FTP
    return $Directorio;
    //Devuelve la ruta a la función
}
开发者ID:FranchuCorraliza,项目名称:html,代码行数:12,代码来源:ftpfunc.php

示例9: GetFTPServer

 static function GetFTPServer()
 {
     if (isset($_SERVER['HTTP_HOST'])) {
         $server = $_SERVER['HTTP_HOST'];
     } elseif (isset($_SERVER['SERVER_NAME'])) {
         $server = $_SERVER['SERVER_NAME'];
     } else {
         return '';
     }
     $conn_id = @ftp_connect($server, 21, 6);
     if ($conn_id) {
         @ftp_quit($conn_id);
         return $server;
     }
     return '';
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:16,代码来源:ftp.php

示例10: sion_ftp_put

 function sion_ftp_put($fileOri)
 {
     // ------------------------------------------------------
     // Esta funcion se encarga de poner un ARCHIVO en FTP.
     // ------------------------------------------------------
     $ftp_server = "ftpham04.hamburgsud.com";
     $ftp_user_name = "ope";
     $ftp_user_pass = "ope0313ftp";
     $path_parts = pathinfo($fileOri);
     $fileX = $path_parts['basename'];
     //$dirRem = $dirRem."/";
     $id_ftp = ftp_connect($ftp_server, 21);
     ftp_login($id_ftp, $ftp_user_name, $ftp_user_pass);
     ftp_pasv($id_ftp, false);
     ftp_chdir($id_ftp, "from");
     if (ftp_put($id_ftp, $fileX, $fileOri, FTP_BINARY)) {
         echo "<hr>OK Cargado : {$fileOri}<hr>";
     } else {
         echo "<hr>No subio : {$fileOri}<hr>";
     }
     ftp_quit($id_ftp);
 }
开发者ID:nesmaster,项目名称:mopsapro,代码行数:22,代码来源:ediHS.php

示例11: attachment_exists

/**
* Check if Attachment exist
*/
function attachment_exists($filename)
{
    global $upload_dir, $config;
    $filename = basename($filename);
    if (!intval($config['allow_ftp_upload'])) {
        if (!@file_exists(@amod_realpath($upload_dir . '/' . $filename))) {
            return false;
        } else {
            return true;
        }
    } else {
        $found = false;
        $conn_id = attach_init_ftp();
        $file_listing = array();
        $file_listing = @ftp_rawlist($conn_id, $filename);
        for ($i = 0, $size = sizeof($file_listing); $i < $size; $i++) {
            if (ereg("([-d])[rwxst-]{9}.* ([0-9]*) ([a-zA-Z]+[0-9: ]*[0-9]) ([0-9]{2}:[0-9]{2}) (.+)", $file_listing[$i], $regs)) {
                if ($regs[1] == 'd') {
                    $dirinfo[0] = 1;
                    // Directory == 1
                }
                $dirinfo[1] = $regs[2];
                // Size
                $dirinfo[2] = $regs[3];
                // Date
                $dirinfo[3] = $regs[4];
                // Filename
                $dirinfo[4] = $regs[5];
                // Time
            }
            if ($dirinfo[0] != 1 && $dirinfo[4] == $filename) {
                $found = true;
            }
        }
        @ftp_quit($conn_id);
        return $found;
    }
}
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:41,代码来源:displaying.php

示例12: listPfiles

function listPfiles($datasrc, $filter = "")
{
    $con = ftp_connect($datasrc->host) or die("Couldn't connect to {$datasrc->host}");
    if (!ftp_login($con, $datasrc->user, $datasrc->pwd)) {
        trigger_error("ftp login to {$datasrc->host} failed.");
        $pfileTree = 0;
    } else {
        $rawFiles = ftp_rawlist($con, $datasrc->dataDir);
        foreach ($rawFiles as $raw) {
            //echo $raw;
            ereg("([-d])([rwxst-]{9}).* ([0-9]*) ([a-zA-Z]+[0-9: ]* [0-9]{2}:?[0-9]{2}) (.+)", $raw, $regs);
            $files[] = array("is_dir" => $regs[1] == "d" ? true : false, "mod" => $regs[2], "size" => $regs[3], "time" => $regs[4], "name" => $regs[5], "raw" => $regs[0]);
        }
        // Find all P-files
        foreach ($files as $f) {
            if (ereg("^P.*\\.7\$", basename($f["name"]))) {
                $pfiles[] = basename($f["name"]);
            }
        }
        if (count($pfiles) > 0) {
            // Now find the tree of files associated with each P-file
            foreach ($pfiles as $pfileNum => $pfile) {
                foreach ($files as $f) {
                    if (ereg(".*" . $pfile . ".*", basename($f["name"]))) {
                        $pfileTree[$pfile]->name[] = $f["name"];
                        $pfileTree[$pfile]->size[] = $f["size"];
                        $pfileTree[$pfile]->time[] = $f["time"];
                    }
                }
            }
        } else {
            $pfileTree = 0;
        }
    }
    ftp_quit($con);
    return $pfileTree;
}
开发者ID:racheldenison,项目名称:megavista,代码行数:37,代码来源:showPfiles.php

示例13: SendViaFTP

function SendViaFTP($i, $source_file, $conn_msg = 1)
{
    global $config, $out, $lang;
    flush();
    if ($conn_msg == 1) {
        $out .= '<span class="success">' . $lang['L_FILESENDFTP'] . "(" . $config['ftp_server'][$i] . " - " . $config['ftp_user'][$i] . ")</span><br>";
    }
    // Herstellen der Basis-Verbindung
    if ($config['ftp_useSSL'][$i] == 0) {
        $conn_id = @ftp_connect($config['ftp_server'][$i], $config['ftp_port'][$i], $config['ftp_timeout'][$i]);
    } else {
        $conn_id = @ftp_ssl_connect($config['ftp_server'][$i], $config['ftp_port'][$i], $config['ftp_timeout'][$i]);
    }
    // Einloggen mit Benutzername und Kennwort
    $login_result = @ftp_login($conn_id, $config['ftp_user'][$i], $config['ftp_pass'][$i]);
    if ($config['ftp_mode'][$i] == 1) {
        ftp_pasv($conn_id, true);
    }
    // Verbindung überprüfen
    if (!$conn_id || !$login_result) {
        $out .= '<span class="error">' . $lang['L_FTPCONNERROR'] . $config['ftp_server'][$i] . $lang['L_FTPCONNERROR1'] . $config['ftp_user'][$i] . $lang['L_FTPCONNERROR2'] . '</span><br>';
    } else {
        if ($conn_msg == 1) {
            $out .= '<span class="success">' . $lang['L_FTPCONNECTED1'] . $config['ftp_server'][$i] . $lang['L_FTPCONNERROR1'] . $config['ftp_user'][$i] . '</span><br>';
        }
    }
    // Upload der Datei
    $dest = $config['ftp_dir'][$i] . $source_file;
    $source = $config['paths']['backup'] . $source_file;
    $upload = @ftp_put($conn_id, $dest, $source, FTP_BINARY);
    // Upload-Status überprüfen
    if (!$upload) {
        $out .= '<span class="error">' . $lang['L_FTPCONNERROR3'] . "<br>({$source} -> {$dest})</span><br>";
    } else {
        $out .= '<span class="success">' . $lang['L_FILE'] . ' <a href="' . $config['paths']['backup'] . $source_file . '" class="smallblack">' . $source_file . '</a>' . $lang['L_FTPCONNECTED2'] . $config['ftp_server'][$i] . $lang['L_FTPCONNECTED3'] . '</span><br>';
        WriteLog("'{$source_file}' sent via FTP.");
    }
    // Schließen des FTP-Streams
    @ftp_quit($conn_id);
}
开发者ID:Otomatic,项目名称:MySQLDumper,代码行数:40,代码来源:functions_dump.php

示例14: ftpClose

 /**
  * close FTP connection
  *
  * @return boolean
  */
 function ftpClose()
 {
     if (!$this->ftp) {
         return false;
     }
     if (@ftp_quit($this->ftp)) {
         $this->addMsg("Closed connection to {$this->host}:{$this->port}");
         $this->ftp = null;
         return true;
     }
     $this->addMsg("Could not close connection to {$this->host}:{$this->port}", 'error');
     return false;
 }
开发者ID:andreyvit,项目名称:retester,代码行数:18,代码来源:FileSystem.php

示例15: getProtocol

function getProtocol($datasrc, $category, $protocol)
{
    // Try to prevent rogue users from getting any random file from the server.
    // This should prevent 'category=../../../' style hacks.
    $category = basename($category);
    $protocol = basename($protocol);
    $con = ftp_connect($datasrc->host) or die("Couldn't connect to {$datasrc->host}");
    if (!ftp_login($con, $datasrc->user, $datasrc->pwd)) {
        trigger_error("ftp login to {$datasrc->host} failed.");
    } else {
        $temp = tmpfile();
        $getFile = $datasrc->protocolDir . "/" . $category . "/" . $protocol;
        $stat = ftp_fget($con, $temp, $getFile, FTP_ASCII);
        rewind($temp);
        $protStr = fread($temp, 1000000);
        fclose($temp);
    }
    ftp_quit($con);
    // PARSE PROTOCOL FILE
    // For debugging:
    //echo "<pre>$protStr</pre>";
    // First, remove the many useless 'GLOBAL' lines
    $protStr = preg_replace("/global .*\n/", "", $protStr);
    // Extract the protocol description fields
    preg_match("/set PROTNAME \"(.*)\"/", $protStr, $matches);
    $p["name"] = $matches[1];
    preg_match("/set REVNO \"(.*)\"/", $protStr, $matches);
    $p["revno"] = $matches[1];
    preg_match("/set SCANNUM \"(.*)\"/", $protStr, $matches);
    $p["scanNum"] = $matches[1];
    preg_match("/set SERIESNUM \"(.*)\"/", $protStr, $matches);
    $p["seriesNum"] = $matches[1];
    // Now, parse each series
    $ser = explode('proc ', $protStr);
    array_shift($ser);
    foreach ($ser as $seriesNum => $seriesStr) {
        $tmp = explode('set ', $seriesStr);
        array_shift($tmp);
        foreach ($tmp as $paramNum => $paramStr) {
            preg_match("/(.*) \"(.*)\"/", $paramStr, $matches);
            $p['series'][$seriesNum + 1][strtolower(trim($matches[1]))] = $matches[2];
            //echo "$seriesNum $matches[1] $p[$seriesNum+1][$matches[1]]";
        }
    }
    return $p;
}
开发者ID:racheldenison,项目名称:megavista,代码行数:46,代码来源:protocolWizard.php


注:本文中的ftp_quit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。