<?
function fn_searchTelnet($QUERY_START_DATETIME,$QUERY_END_DATETIME,$QUERY_IP,$QUERY_IP_1,$QUERY_ID,$QUERY_ACCOUNT){
	require("../_read_source/_telnet.php");
	
	 if ($QUERY_ID != '') {
		$strSQL = $strSQL." and ".$DB_TELNET_AUTO." = '".$QUERY_ID."'";
	}
	else{
		//if ($QUERY_START_DATETIME == '') $QUERY_START_DATETIME = "19000101000000";
		//if ($QUERY_END_DATETIME == '') $QUERY_END_DATETIME = "20371231235959";
		
			if (($QUERY_START_DATETIME != '')||($QUERY_END_DATETIME != ''))$strSQL = " and ".$DB_TELNET_DATETIME." between '".$QUERY_START_DATETIME."' and '".$QUERY_END_DATETIME."'";

		if ($QUERY_IP_1 != '') { 
			if ($QUERY_IP != '') $strSQL=$strSQL." and ".$DB_TELNET_IP." = '".$QUERY_IP."'";
        }
		else{
			if ($QUERY_IP != '') $strSQL=$strSQL." and ".$DB_TELNET_IP." like '".$QUERY_IP."%'";
		}

		if($QUERY_ACCOUNT != ''){
			$strSQL = $strSQL." and ".$DB_TELNET_ACCOUNT."='".$QUERY_ACCOUNT."'";
		}

	}

	return $strSQL;
}
?>