wenn ich es so mache bekomme ich nur 1 bei beiden ftps zurück
<?php
function RemoteFileSize( $url ){
$sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
$url = str_replace( FTPURL, '', $url );
if( $open = ftp_connect( FTPADDR ) ){
ftp_login( $open, FTPUSER, FTPPASS );
$res = ftp_size( $open, $url );
$ret = ( $res != "-1" ? (round($res/pow(1024, ($i = floor(log($res, 1024)))), 2) . $sizes[$i]) : "N/A" );
ftp_quit( $open );
}else{
$ret = "Connecting Faild";
}
return $ret;
}
function RemoteFileSize1( $url ){
$sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
$url = str_replace( FTPURL1, '', $url );
if( $open = ftp_connect( FTPADDR1 ) ){
ftp_login( $open, FTPUSER1, FTPPASS1 );
$res = ftp_size( $open, $url );
$ret = ( $res != "-1" ? (round($res/pow(1024, ($i = floor(log($res, 1024)))), 2) . $sizes[$i]) : "N/A" );
ftp_quit( $open );
}else{
$ret = "Connecting Faild";
}
return $ret;
}
$lokal = get_download_size($row['url']);
$row['size'] = ( $lokal == "n/a" ? RemoteFileSize( $row['url'] ) : $lokal OR $lokal == "n/a" ? RemoteFileSize1( $row['url'] ) : $lokal);
?>
mach ich es so dann geht nur einer von zwei weil die erste variable von der zweiten überschrieben wir (denk ich mal)
<?php
function RemoteFileSize( $url ){
$sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
$url = str_replace( FTPURL, '', $url );
$url = str_replace( FTPURL1, '', $url );
if( $open = ftp_connect( FTPADDR ) ){
ftp_login( $open, FTPUSER, FTPPASS );
$res = ftp_size( $open, $url );
$ret = ( $res != "-1" ? (round($res/pow(1024, ($i = floor(log($res, 1024)))), 2) . $sizes[$i]) : "N/A" );
ftp_quit( $open );
}
if( $open = ftp_connect( FTPADDR1 ) ){
ftp_login( $open, FTPUSER1, FTPPASS1 );
$res = ftp_size( $open, $url );
$ret = ( $res != "-1" ? (round($res/pow(1024, ($i = floor(log($res, 1024)))), 2) . $sizes[$i]) : "N/A" );
ftp_quit( $open );
}
else{
$ret = "Connecting Faild";
}
return $ret;
}
$lokal = get_download_size($row['url']);
$row['size'] = ( $lokal == "n/a" ? RemoteFileSize( $row['url'] ) : $lokal );
?>