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


PHP Ftp::login方法代码示例

本文整理汇总了PHP中Ftp::login方法的典型用法代码示例。如果您正苦于以下问题:PHP Ftp::login方法的具体用法?PHP Ftp::login怎么用?PHP Ftp::login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ftp的用法示例。


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

示例1: process

 /**
  * @param DatabaseBackupFile $file
  * @return ResultObject[]
  */
 public function process(DatabaseBackupFile $file)
 {
     $d = $file->getBackupDate();
     $results = [];
     foreach ($this->uploadsCredentials as $credentials) {
         $result = new ResultObject();
         // empty ResultObject means all is OK
         $backupPath = $credentials['path'] . '/' . $d->format('Y') . '/' . $d->format('F');
         $entireFilePath = $backupPath . '/' . $file->getFileName();
         try {
             $ftp = new \Ftp();
             $ftp->connect($credentials['host']);
             $ftp->login($credentials['username'], $credentials['password']);
             if (!$ftp->fileExists($backupPath)) {
                 $ftp->mkDirRecursive($backupPath);
             }
             $ftp->put($entireFilePath, $file->getFilePath(), FTP_BINARY);
             $ftp->close();
         } catch (\FtpException $e) {
             $this->logger->addCritical(sprintf('Uploading backup file\'s failed. %s', $e));
             $result->addError('Zálohu se nepodařilo nahrát na: ' . $credentials['host'], 'error');
         }
         $results[] = $result;
     }
     return $results;
 }
开发者ID:blitzik,项目名称:vycetky-doctrine,代码行数:30,代码来源:DatabaseBackupFileHandler.php

示例2: testFailure

 public function testFailure()
 {
     $ftp = new Ftp("chc-deaf.org.ua");
     $ftp->login("chc-deaf", "moskvich408");
     $this->assertFalse($ftp->push_file("/file/maxim3.jpg", "../maxim3.jpg", "jpg2"));
     $this->assertFalse($ftp->push_file("/file/maxim3.jpg", "../maxim3.jpg", "doc"));
 }
开发者ID:KosovMax,项目名称:ftp2,代码行数:7,代码来源:testFtp.php

示例3: update

 /**
  * Ist für den Abgleich der Bestellungen im Cronjob.
  */
 public function update()
 {
     global $selectline, $oxid, $ftp;
     $this->set_log('Cronjob: ' . date('d.m.Y H:i:s') . "\r\n");
     try {
         $ftp = new Ftp();
         $ftp->connect($oxid['ftp_host']);
         $ftp->login($oxid['ftp_user'], $oxid['ftp_password']);
         $ftp->close();
     } catch (Exception $e) {
         $this->set_log('SelectConnect konnte keine Verbindung zum FTP-Server herstellen!');
         exit;
     }
     if (!oxid_userlogin()) {
         $this->set_log('SelectConnect konnte sich nicht bei Oxid einloggen!');
         exit;
     }
     if (!$this->is_current_update_process()) {
         $this->set_log("Cronjob wurde gestartet \r\n");
         $this->set_lock_file();
         $last_update = $this->get_last_update();
         $this->set_log("Bestellungen werden in Selectline importiert \r\n");
         $orders = $oxid['db']->get_results("SELECT * FROM " . $oxid['table_order'] . " WHERE OXFOLDER  = '" . $oxid['get_order_status'] . "' ORDER BY OXORDERNR");
         if ($orders) {
             foreach ($orders as $order) {
                 $order_products = $oxid['db']->get_results("SELECT * FROM " . $oxid['table_orderarticles'] . " WHERE OXORDERID = '" . $order->OXID . "' ");
                 $order->products = $order_products;
                 $order_payment = $oxid['db']->get_row("SELECT * FROM " . $oxid['table_payments'] . " WHERE ('" . $order->OXPAYMENTTYPE . "' = OXID)");
                 $order->payment = $order_payment;
                 $this->set_order_to_selectline($order, true);
                 $oxid['db']->query("UPDATE " . $oxid['table_order'] . " SET OXFOLDER = '" . $oxid['set_order_status'] . "', OXEXPORT = 1 WHERE `OXID` = '" . $order->OXID . "' ");
             }
         }
         $this->set_log("Bestellungstatus wird abgeglichen \r\n");
         $orders = $selectline['db']->get_results("SELECT * FROM " . $selectline['table_orders'] . " WHERE [Belegtyp] = '" . $selectline['filter_order_invoice'] . "' AND [BearbeitetAm] >= CONVERT(datetime, '" . $last_update->format('d.m.Y H:i:s') . "',104)");
         if ($orders) {
             foreach ($orders as $order) {
                 $tracking_id = $this->get_tracking_id_from_selectline($order);
                 $updateArray = array('OXBILLNR' => $order->Belegnummer, 'OXBILLDATE' => $order->Datum->format('Y-m-d'), 'OXSENDDATE' => $order->Datum->format('Y-m-d H:i:s'), 'OXFOLDER' => $oxid['order_status_finish']);
                 if ($tracking_id !== NULL) {
                     $updateArray['OXTRACKCODE'] = $tracking_id;
                 }
                 //print_r($this->format_update_query($oxid['table_order'], $updateArray, array('OXORDERNR' => str_replace('OX', '', $order->IhrAuftrag))));
                 $oxid['db']->query($this->format_update_query($oxid['table_order'], $updateArray, array('OXORDERNR' => str_replace('OX', '', $order->IhrAuftrag))));
                 $this->set_log("Bestellung " . $order->IhrAuftrag . "/" . $order->Belegnummer . " - Status: FINISHED - Tracking: " . $tracking_id . " \r\n");
             }
         }
         $this->set_last_update();
         $this->remove_lock_file();
         $this->set_log("Cron wurde beendet \r\n");
         $this->set_log("\r\n##################################\r\n\r\n");
     } else {
         print_r('Error: Es läuft bereits Update-Prozess.');
     }
 }
开发者ID:baltruschat,项目名称:selectconnect,代码行数:58,代码来源:orders.php

示例4: testDownload

 /**
  * Download test.
  * @return void
  */
 public function testDownload()
 {
     $ftp = new Ftp();
     // Opens an FTP connection to the specified host
     $ftp->connect('ftp.nettephp.com');
     $ftp->pasv(TRUE);
     // Login with username and password
     $ftp->login('nette@php7.org', 'anonymous');
     // Download file 'README' to local temporary file
     $temp = tmpfile();
     $ftp->fget($temp, 'README', Ftp::ASCII);
     // echo file
     fseek($temp, 0);
     $this->assertEquals("Nette Framework rocks!", stream_get_contents($temp));
 }
开发者ID:vrana,项目名称:nette,代码行数:19,代码来源:NetteWebFtpTest.php

示例5: trim

foreach ($listaIds as $contentId) {
    $contentId = trim($contentId);
    $log .= "\tprocessando {$contentId}\n";
    $realtone = new druttRealtone($dbc, $debug);
    try {
        $realtone->loadContent($contentId);
    } catch (Exception $e) {
        $log .= "loadContent: " . $e->getMessage() . "\n";
    }
    try {
        $content_download = FALSE;
        $realtone->setTag($catdrutt);
        // descargo contenido por FTP
        $log .= "\tdescargando contenido...\n";
        $ftpCon = new Ftp();
        $conectado = $ftpCon->login();
        if ($conectado !== TRUE) {
            $conectado = $ftpCon->login();
        }
        if ($conectado !== TRUE) {
            $conectado = $ftpCon->login();
        }
        if ($conectado !== TRUE) {
            $conectado = $ftpCon->login();
        }
        if ($conectado === TRUE) {
            $to = $tmpDir . "/" . $realtone->getContentFilename();
            $from = $realtone->getContent();
            $bajado = $ftpCon->bajar($from, $to);
            if ($bajado !== TRUE) {
                $bajado = $ftpCon->bajar($from, $to);
开发者ID:vallejos,项目名称:samples,代码行数:31,代码来源:process-realtone.php

示例6: set_product_images_oxid

 /**
  * [set_product_images_oxid description]
  * @param [type] $product [description]
  */
 private function set_product_images_oxid($product)
 {
     global $oxid, $selectline;
     $product->images = $selectline['db']->get_results("SELECT * FROM " . $selectline['table_product_img'] . " WHERE [Blobkey] = 'AR" . $product->Artikelnummer . "'");
     if ($product->images) {
         $i = 1;
         $ftp = new Ftp();
         $ftp->connect($oxid['ftp_host']);
         $ftp->login($oxid['ftp_user'], $oxid['ftp_password']);
         foreach ($product->images as $image) {
             $img = WideImage::load($image->Bild);
             if ($i > 1) {
                 $filename = $product->ART_ID . '_' . $i . '.jpg';
             } else {
                 $filename = $product->ART_ID . '.jpg';
             }
             $img->saveToFile(ABSPATH . '/images/' . $filename);
             $ftp->put($oxid['img_path'] . '/master/product/' . $i . '/' . $filename, ABSPATH . '/images/' . $filename, FTP_BINARY);
             @unlink(ABSPATH . '/images/' . $filename);
             $oxid['db']->query($this->format_update_query($oxid['table_products'], array('OXPIC1' => $filename), array('OXID' => $product->ART_ID)));
             $i++;
         }
         $ftp->close();
     }
 }
开发者ID:baltruschat,项目名称:selectconnect,代码行数:29,代码来源:products.php

示例7: Ftp

	<script src="js/jquery-2.1.3.min.js"></script>
	<script src="js/jQuery.ajaxQueue.js"></script>
	<script src="bootstrap/js/bootstrap.min.js"></script>
	<script src="bootstrap/js/bootstrap-select.min.js"></script>

</head>
<body class="<?php 
echo $action;
?>
">
<?php 
try {
    $ftp = new Ftp();
    $ftp->connect($oxid['ftp_host']);
    $ftp->login($oxid['ftp_user'], $oxid['ftp_password']);
    $ftp->close();
} catch (Exception $e) {
    print_r('<p class="alert alert-danger">SelectConnect konnte keine Verbindung zum FTP-Server herstellen!</p>');
    $action = 'error';
}
if (!oxid_userlogin()) {
    print_r('<p class="alert alert-danger">SelectConnect konnte sich nicht bei Oxid einloggen!</p>');
    $action = 'error';
}
switch ($action) {
    case 'orders':
        $orders = new Orders();
        $items = $orders->import();
        ?>
			<h1>SelectConnect | Bestellungen</h1>
开发者ID:baltruschat,项目名称:selectconnect,代码行数:30,代码来源:index.php

示例8: Ftp

<?php

$db = Typeframe::Database();
$pm = Typeframe::Pagemill();
if (empty($_SESSION['typef_ftp_user']) || empty($_SESSION['typef_ftp_pass'])) {
    if (defined('TYPEF_FTP_USER') && defined('TYPEF_FTP_PASS') && TYPEF_FTP_USER != '') {
        // Test the provided credentials
        $ftp = new Ftp();
        $ftp->connect(TYPEF_FTP_HOST) or die('Invalid FTP host.');
        if ($ftp->login(TYPEF_FTP_USER, TYPEF_FTP_PASS)) {
            $_SESSION['typef_ftp_user'] = TYPEF_FTP_USER;
            $_SESSION['typef_ftp_pass'] = TYPEF_FTP_PASS;
            $ftp->close();
            return;
        }
    }
    $pm->setVariable('redirect', $_SERVER['REQUEST_URI']);
    Typeframe::SetPageTemplate('/admin/ftp/login.html');
    Typeframe::CurrentPage()->stop();
}
开发者ID:ssrsfs,项目名称:blg,代码行数:20,代码来源:require.php

示例9: Ftp

<?php

$db = Typeframe::Database();
$pm = Typeframe::Pagemill();
if ($_POST['cmd'] == 'login') {
    $ftp = new Ftp();
    if (!$ftp->connect(TYPEF_FTP_HOST)) {
        Typeframe::Log("Failed to connect to FTP at '" . TYPEF_FTP_HOST . "'");
        $pm->addLoop('errors', array('message' => "Could not connect to '" . TYPEF_FTP_HOST . "'"));
    } else {
        if (!$ftp->login($_POST['username'], $_POST['password'])) {
            Typeframe::Log('FTP login failed');
            $pm->addLoop('errors', array('message' => "Login failed."));
        } else {
            Typeframe::Log('FTP login succeeded');
            $_SESSION['typef_ftp_user'] = $_POST['username'];
            $_SESSION['typef_ftp_pass'] = $_POST['password'];
            Typeframe::Redirect('FTP login confirmed.', $_POST['redirect']);
            return;
        }
    }
    $pm->setVariable('redirect', $_POST['redirect']);
}
开发者ID:ssrsfs,项目名称:blg,代码行数:23,代码来源:login.php

示例10: do_create


//.........这里部分代码省略.........
            $data['custom_creative_height'] = 480;
        }
        // End Define Image Sizes
        // IF CREATIVE TYPE =1, ATTEMPT TO UPLOAD CREATIVE
        if ($data['creative_type'] == 1) {
            $creative_server = getconfig_var('default_creative_server');
            // Generate Creative Hash
            $uniqid = uniqid(time());
            $creative_hash = md5($uniqid);
            $file_extension = strtolower(substr(strrchr($_FILES['creative_file']['name'], "."), 1));
            // Case: Remote Creative Server (FTP)
            if (getconfig_var('default_creative_server') > 1) {
                list($width, $height, $type, $attr) = getimagesize($_FILES['creative_file']['tmp_name']);
                if ($height != $data['custom_creative_height'] or $width != $data['custom_creative_width'] or empty($file_extension)) {
                    global $errormessage;
                    $errormessage = 'The image you uploaded does not appear to be in the right dimensions. Please upload a valid image sized ' . $data['custom_creative_width'] . 'x' . $data['custom_creative_height'] . '';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
                $creative_server_detail = get_creativeserver_detail(getconfig_var('default_creative_server'));
                if ($creative_server_detail['entry_id'] < 1) {
                    global $errormessage;
                    $errormessage = 'The default creative server does not seem to exist. Please change your creative server in your mAdserve control panel under Configuration>Creative Servers';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
                // Attempt: Upload
                include MAD_PATH . '/modules/ftp/ftp.class.php';
                try {
                    $ftp = new Ftp();
                    $ftp->connect($creative_server_detail['remote_host']);
                    $ftp->login($creative_server_detail[remote_user], $creative_server_detail[remote_password]);
                    $ftp->put($creative_server_detail[remote_directory] . $creative_hash . '.' . $file_extension, $_FILES['creative_file']['tmp_name'], FTP_BINARY);
                } catch (FtpException $e) {
                    global $errormessage;
                    $errormessage = 'FTP Client was unable to upload creative to remote server. Error given: ' . $e->getMessage() . '';
                    global $editdata;
                    $editdata = $data;
                    return false;
                }
                // End: Upload
            }
            // End Case: Remote Creative Server (FTP)
            // Case: Local Creative Server
            if (getconfig_var('default_creative_server') == 1) {
                include MAD_PATH . '/modules/upload/class.upload.php';
                $handle = new Upload($_FILES['creative_file']);
                $handle->allowed = array('image/*');
                $handle->file_new_name_body = $creative_hash;
                if ($handle->uploaded) {
                    $image_width = $handle->image_src_x;
                    $image_height = $handle->image_src_y;
                    if (!empty($image_width) && !empty($image_height) && ($image_height != $data['custom_creative_height'] or $image_width != $data['custom_creative_width'])) {
                        global $errormessage;
                        $errormessage = 'The image you uploaded does not appear to be in the right dimensions. Please upload an image sized ' . $data['custom_creative_width'] . 'x' . $data['custom_creative_height'] . '';
                        global $editdata;
                        $editdata = $data;
                        return false;
                    }
                    $handle->Process(MAD_PATH . MAD_CREATIVE_DIR);
                    if ($handle->processed) {
                        // OK
                    } else {
                        global $errormessage;
开发者ID:aiurlano,项目名称:mAdserve-Fork,代码行数:67,代码来源:admin_functions.php

示例11: run

 /**
  * Runs the FTP deploy task.
  *
  * @return Result The result of the task.
  */
 public function run()
 {
     $ftp = new \Ftp();
     // connect to the server
     try {
         if ($this->useSSL) {
             $ftp->sslConnect($this->host);
         } else {
             $ftp->connect($this->host);
         }
         $ftp->login($this->user, $this->password);
         // create the target directory if it does not exist
         $ftp->chdir('/');
         if (!$ftp->fileExists($this->targetDirectory)) {
             $this->printTaskInfo('Creating directory: ' . $this->targetDirectory);
             $ftp->mkDirRecursive($this->targetDirectory);
         }
         // get files from git if enabled
         if ($this->gitDiff) {
             $this->files($this->getGitDiff($ftp));
         }
         // scan and index files in finder
         $this->printTaskInfo('Scanning files to upload...');
         // add discrete files
         $this->finder->append(new \ArrayIterator($this->files));
         // directories first
         $this->finder->sortByType();
         // display summary before deploying
         $this->printTaskInfo(sprintf('Deploying %d files to "%s://%s@%s%s"...', $this->finder->count(), $this->useSSL ? 'ftps' : 'ftp', $this->user, $this->host, $this->targetDirectory));
         // upload each file, starting with directories
         foreach ($this->finder as $file) {
             $this->upload($ftp, $file);
         }
         // close the connection
         $ftp->close();
     } catch (\FtpException $e) {
         return Result::error($this, 'Error: ' . $e->getMessage());
     }
     // success!
     return Result::success($this, 'All files deployed.');
 }
开发者ID:coderstephen,项目名称:robo-ftp,代码行数:46,代码来源:FtpDeployTask.php

示例12: Ftp

<?php

require_once 'ftp.class.php';
try {
    $ftp = new Ftp();
    // Opens an FTP connection to the specified host
    $ftp->connect('ftp.ed.ac.uk');
    // Login with username and password
    $ftp->login('anonymous', 'example@example.com');
    // Download file 'README' to local temporary file
    $temp = tmpfile();
    $ftp->fget($temp, 'README', Ftp::ASCII);
    // echo file
    echo '<pre>';
    fseek($temp, 0);
    fpassthru($temp);
} catch (FtpException $e) {
    echo 'Error: ', $e->getMessage();
}
开发者ID:liulingfu,项目名称:madserve,代码行数:19,代码来源:example.php

示例13: function

// www.xtac.net
$container['template'] = function ($c) {
    $tpl = new \Template_();
    $tpl->skin = 'bootstrap';
    return $tpl;
};
// logger
$container['logger'] = function ($c) {
    $logger = new Kaiser\Manager\LogManager(__DIR__ . '/../logs');
    return $logger;
};
// session
$container['session'] = function ($c) {
    $session = new Kaiser\Session\FileSession(__DIR__ . '/../tmp');
    $session->start_session();
    return $session;
};
// ftp
$container['ftp'] = function ($c) {
    $ftp = new \Ftp();
    // Opens an FTP connection to the specified host
    $ftp->connect($c['config']->get('ftp.host'));
    if (!empty($c['config']->get('ftp.user')) && !empty($c['config']->get('ftp.pass'))) {
        // Login with username and password
        $ftp->login($c['config']->get('ftp.user'), $c['config']->get('ftp.pass'));
    } elseif (!empty($_SESSION['user']['username']) && !empty($_SESSION['user']['password'])) {
        $ftp->login($_SESSION['user']['username'], $_SESSION['user']['password']);
    }
    $ftp->pasv($c['config']->get('ftp.passive'));
    return $ftp;
};
开发者ID:mclkim,项目名称:webftp,代码行数:31,代码来源:dependencies.php

示例14: fn_copy_by_ftp

/**
 * Copies files using FTP access
 *
 * @param string $source Absolute path (non-ftp) to source dir/file
 * @param string $destination Absolute path (non-ftp) to destination dir/file
 * @param array $ftp_access
 *      array(
 *          'hostname',
 *          'username',
 *          'password',
 *          'directory'
 *      )
 * @return bool true if all files were copied or (string) Error message
 */
function fn_copy_by_ftp($source, $destination, $ftp_access)
{
    try {
        $ftp = new Ftp();
        $ftp->connect($ftp_access['hostname']);
        $ftp->login($ftp_access['username'], $ftp_access['password']);
        $ftp->chdir($ftp_access['directory']);
        $files = $ftp->nlist('');
        if (!empty($files) && in_array('config.php', $files)) {
            $ftp_destination = str_replace(Registry::get('config.dir.root'), '', $destination);
            if (is_file($source)) {
                // File
                try {
                    $file = ltrim($ftp_destination, '/');
                    $ftp->put($file, $source, FTP_BINARY);
                } catch (FtpException $e) {
                    throw new FtpException('ftp_access_denied' . ':' . $e->getMessage());
                }
            } else {
                // Dir
                $ftp->chdir($ftp_access['directory'] . $ftp_destination);
                $struct = fn_get_dir_contents($source, false, true, '', '', true);
                foreach ($struct as $file) {
                    $dir = dirname($file);
                    if (!$ftp->isDir($dir)) {
                        try {
                            $ftp->mkDirRecursive($dir);
                        } catch (FtpException $e) {
                            throw new FtpException('ftp_access_denied' . ':' . $e->getMessage());
                        }
                    }
                    try {
                        $ftp->put($file, $source . $file, FTP_BINARY);
                    } catch (FtpException $e) {
                        throw new FtpException('ftp_access_denied' . ':' . $e->getMessage());
                    }
                }
            }
            return true;
        } else {
            throw new FtpException('ftp_directory_is_incorrect');
        }
    } catch (FtpException $e) {
        return __('invalid_ftp_access') . ': ' . $e->getMessage();
    }
    return false;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:61,代码来源:fn.fs.php

示例15: limpiarCagadas

function limpiarCagadas($newId)
{
    extract($GLOBALS);
    print "<h4>Borrando archivos:</h4>";
    foreach ($_SESSION['subidos'] as $k) {
        $auxSvr = split("@", $k);
        $file = $auxSvr[0];
        $srvr = $auxSvr[1];
        print "<h4>Borrando registros</h4>";
        print "borrando: {$file}<br />";
        $ftp = new Ftp($servers[$srvr][0], $servers[$srvr][1], $servers[$srvr][2]);
        if (!$ftp->login()) {
            die("no se logueó");
        }
        if (!$ftp->borrar($file)) {
            print "No se pudo borrar: {$file}<br />";
            error("No se pudo borrar: {$file}", true);
        }
    }
    $sql = " DELETE FROM contenidos where id={$newId} LIMIT 1; ";
    $result = mysql_query($sql, $db);
    if (!$result) {
        error("Error al borrar el contenido {$newId} -  sql: {$sql}", true);
    }
    print "contenido {$newId} eliminado!\n";
    $sql = " DELETE FROM contcol_whitelist where contenido={$newId} LIMIT 1; ";
    $result = mysql_query($sql, $db);
    if (!$result) {
        error("Error al borrar de witelist {$newId} -  sql: {$sql}", true);
    }
    print "contenido {$newId} eliminado de whitelist!\n";
    $ftp->logout();
}
开发者ID:vallejos,项目名称:samples,代码行数:33,代码来源:subirWallpapers.php


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