0
0
function dftp_connect($ftphost, $ftpuser, $ftppass, $ftppath, $ftpport = 21, $ftpssl = 0, $silent = 0) {
global $ftp;
@set_time_limit(0);
$ftphost = wipespecial($ftphost);
$ftpport = intval($ftpport);
$ftpssl = intval($ftpssl);
$ftp['timeout'] = intval($ftp['timeout']);
$func = $ftpssl && function_exists('ftp_ssl_connect') ? 'ftp_ssl_connect' : 'ftp_connect';
if($func == 'ftp_connect' && !function_exists('ftp_connect')) {
if($silent) {
return -4;
} else {
errorlog('FTP', "FTP not supported.", 0);
}
}
if($ftp_conn_id = @$func($ftphost, $ftpport, 20)) {
if($ftp['timeout'] && function_exists('ftp_set_option')) {
@ftp_set_option($ftp_conn_id, FTP_TIMEOUT_SEC, $ftp['timeout']);
}
if(dftp_login($ftp_conn_id, $ftpuser, $ftppass)) {
if($ftp['pasv']) {
dftp_pasv($ftp_conn_id, TRUE);
}
if(dftp_chdir($ftp_conn_id, $ftppath)) {
return $ftp_conn_id;
} else {
if($silent) {
return -3;
} else {
errorlog('FTP', "Chdir '$ftppath' error.", 0);
}
}
} else {
if($silent) {
return -2;
} else {
errorlog('FTP', '530 Not logged in.', 0);
}
}
} else {
if($silent) {
return -1;
} else {
errorlog('FTP', "Couldn't connect to $ftphost:$ftpport.", 0);
}
}
dftp_close($ftp_conn_id);
return -1;
}
function dftp_mkdir($ftp_stream, $directory) {
$directory = wipespecial($directory);
return @ftp_mkdir($ftp_stream, $directory);
}
function dftp_rmdir($ftp_stream, $directory) {
$directory = wipespecial($directory);
return @ftp_rmdir($ftp_stream, $directory);
}
function dftp_put($ftp_stream, $remote_file, $local_file, $mode, $startpos = 0 ) {
$remote_file = wipespecial($remote_file);
$local_file = wipespecial($local_file);
$mode = intval($mode);
$startpos = intval($startpos);
return @ftp_put($ftp_stream, $remote_file, $local_file, $mode, $startpos);
}
function dftp_size($ftp_stream, $remote_file) {
$remote_file = wipespecial($remote_file);
return @ftp_size($ftp_stream, $remote_file);
}
function dftp_close($ftp_stream) {
return @ftp_close($ftp_stream);
}
function dftp_delete($ftp_stream, $path) {
$path = wipespecial($path);
return @ftp_delete($ftp_stream, $path);
}
function dftp_get($ftp_stream, $local_file, $remote_file, $mode, $resumepos = 0) {
$remote_file = wipespecial($remote_file);
$local_file = wipespecial($local_file);
$mode = intval($mode);
$resumepos = intval($resumepos);
return @ftp_get($ftp_stream, $local_file, $remote_file, $mode, $resumepos);
}
function dftp_login($ftp_stream, $username, $password) {
$username = wipespecial($username);
$password = str_replace(array("n", "r"), array('', ''), $password);
return @ftp_login($ftp_stream, $username, $password);
}
function dftp_pasv($ftp_stream, $pasv) {
$pasv = intval($pasv);
return @ftp_pasv($ftp_stream, $pasv);
}
function dftp_chdir($ftp_stream, $directory) {
$directory = wipespecial($directory);
return @ftp_chdir($ftp_stream, $directory);
}
function dftp_site($ftp_stream, $cmd) {
$cmd = wipespecial($cmd);
return @ftp_site($ftp_stream, $cmd);
}
function dftp_chmod($ftp_stream, $mode, $filename) {
$mode = intval($mode);
$filename = wipespecial($filename);
if(function_exists('ftp_chmod')) {
return @ftp_chmod($ftp_stream, $mode, $filename);
} else {
return dftp_site($ftp_stream, 'CHMOD '.$mode.' '.$filename);
}
}
相关标签:
本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门AI工具
相关专题
2026赚钱平台入口大全
2026年最新赚钱平台入口汇总,涵盖任务众包、内容创作、电商运营、技能变现等多类正规渠道,助你轻松开启副业增收之路。阅读专题下面的文章了解更多详细内容。
268
2026.01.31
无需付费的漫画app大全
想找真正免费又无套路的漫画App?本合集精选多款永久免费、资源丰富、无广告干扰的优质漫画应用,涵盖国漫、日漫、韩漫及经典老番,满足各类阅读需求。阅读专题下面的文章了解更多详细内容。
170
2026.01.31
漫画免费在线观看地址大全
想找免费又资源丰富的漫画网站?本合集精选2025-2026年热门平台,涵盖国漫、日漫、韩漫等多类型作品,支持高清流畅阅读与离线缓存。阅读专题下面的文章了解更多详细内容。
85
2026.01.31
热门下载
相关下载
精品课程
相关推荐
/
热门推荐
/
最新课程







