<?
function fn_searchFtp($QUERY_START_DATETIME,$QUERY_END_DATETIME,$QUERY_IP,$QUERY_IP_1,$QUERY_DIR,$QUERY_USER,$QUERY_SITE,$QUERY_ORGNAME,$QUERY_ID,$QUERY_ACCOUNT){
	require("../_read_source/_ftp.php");
    if ($QUERY_ID != '') {
		$strSQL = $strSQL." and _AUTO = '".$QUERY_ID."'";
	}
	else{
		//if ($QUERY_START_DATETIME == '') $QUERY_START_DATETIME = "19000000000000";
		//if ($QUERY_END_DATETIME == '') $QUERY_END_DATETIME = "20371231235959";		
		if (($QUERY_START_DATETIME != '')||($QUERY_END_DATETIME != ''))$strSQL = " and ".$DB_FTP_DATETIME." between '".$QUERY_START_DATETIME."' and '".$QUERY_END_DATETIME."'";

		if ($QUERY_IP_1 != '') { 
			if ($QUERY_IP != '') $strSQL=$strSQL." and ".$DB_FTP_IP." = '".$QUERY_IP."'";
        }
		else{
			if ($QUERY_IP != '') $strSQL=$strSQL." and ".$DB_FTP_IP." like '".$QUERY_IP."%'";
		}
		if ($QUERY_USER != '') $strSQL = $strSQL." and ".$DB_FTP_USER."='".$QUERY_USER."'";
		if ($QUERY_DIR != '') $strSQL = $strSQL." and ".$DB_FTP_DIR."='".$QUERY_DIR."'";
		if ($QUERY_SITE != '') $strSQL = $strSQL." and ".$DB_FTP_SITE."='".$QUERY_SITE."'";
		if ($QUERY_ORGNAME != '') $strSQL = $strSQL." and ".$DB_FTP_ORGNAME." like '%".$QUERY_ORGNAME."%'";
		if($QUERY_ACCOUNT != ''){
			$strSQL = $strSQL." and ".$DB_FTP_ACCOUNT."='".$QUERY_ACCOUNT."'";
		}
    }
	return $strSQL;
}
?>