New paste Repaste Download
/* Ftp statements */
function ftp($host,$user,$password,$uri,$type,$local,$r){
$port=21;
$timeout=90;
<------>$connection=@ftp_connect($host,$port,$timeout) or die('Couldn\'t connect to '.$host);
<------>$login=@ftp_login($connection,$user,$password);
<------>if($r==='HEAD'){
<------><------>$result=@ftp_size($connection,$uri);
<------>}else if($r==='GET'&&$type==='bin'){
<------><------>if(file_exists('/home/roby/www_data/it/mailstat/'.$local)){
<------><------><------>unlink('/home/roby/www_data/it/mailstat/'.$local);
<------><------><------>sleep(1);
<------><------>}
<------><------>$result=@ftp_get($connection,$local,$uri,FTP_BINARY);
<------>}else if($r==='GET'&&$type==='txt'){
<------><------>if(file_exists('/home/roby/www_data/it/mailstat/'.$local)){
<------><------><------>unlink('/home/roby/www_data/it/mailstat/'.$local);
<------><------><------>sleep(1);
<------><------>}
<------><------>/* fix enable passive mode */
<------><------>@ftp_pasv($connection,true);
<------><------>$result=@ftp_get($connection,$local,$uri,FTP_ASCII);
<------>}
<------>/* if($result!=-1){ echo $result; }else{ echo $error; } */
<------>@ftp_close($connection);
return $result;
}
Filename: None. Size: 1kb. View raw, , hex, or download this file.

This paste expires on 2026-01-09 20:45:45.003693+00:00. Pasted through web.