예제 #1
0
파일: mig.php 프로젝트: dalinhuang/shopexts
 $startline = $_GET['startline'];
 //起始行
 $_POST = unserialize(stripslashes($_COOKIE['POST_VARS']));
 rptout("开始文件传输...\n");
 //ftp_pasv($conn_id, true);
 $ftp = new FTP();
 if (!$ftp->connect($_POST['server'], $_POST['port'])) {
     die($ftp->error());
 }
 echo nl2br($ftp->greet());
 $ftp->login($_POST['user'], $_POST['pass']);
 echo "<br>";
 echo $ftp->error();
 echo "<br>";
 echo nl2br($ftp->features());
 $ftp->setType('FTP_BINARY');
 echo "<br>Connect Ok<br>";
 $fp_list = fopen('migtask.txt', 'r');
 for ($i = 1; $i < $startline; $i++) {
     fgetline($fp_list);
 }
 //跳至起始行
 $session_count = 0;
 while ($buffer = fgetline($fp_list)) {
     $startline++;
     $session_count++;
     if (substr($buffer, 0, 4) == 'DIR:') {
         @$ftp->mkdir($_POST['remotepath'] . substr($buffer, 5));
         rptout("<font color=green>" . $_POST['remotepath'] . substr($buffer, 5) . "目录已建立</font>");
         $dirs_num++;
     }