<?
function search($QUERY_START_DATETIME,$QUERY_END_DATETIME,$QUERY_IP,$QUERY_IP_1,$QUERY_HOST,$QUERY_ID,$QUERY_ACCOUNT,$QUERY_STAUTS){
		
	if($QUERY_STAUTS == "http"){
		require("../_read_source/_httplog.php");
		$_DATE  		= $DB_HTTPLOG_DATETIME;
		$_IP			= $DB_HTTPLOG_IP;
		$_HOST  		= $DB_HTTPLOG_HOST;
		$_AUTO  		= $DB_HTTPLOG_AUTO;
		$_ACCOUNT  		= $DB_HTTPLOG_ACCOUNT;
	}
	elseif($QUERY_STAUTS == "dynamic"){
		require("../_read_source/_http_page.php");
		$_DATE	    	= $DB_HTTP_PAGE_DATETIME;
		$_IP     		= $DB_HTTP_PAGE_IP;
		$_HOST			= $DB_HTTP_PAGE_HOST;
		$_AUTO 		    = $DB_HTTP_PAGE_AUTO;
		$_ACCOUNT  		= $DB_HTTP_PAGE_ACCOUNT;
	}

    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 ".$_DATE." between '".$QUERY_START_DATETIME."' and '".$QUERY_END_DATETIME."'";

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

		if ($QUERY_HOST != '') $strSQL=$strSQL." and ".$_HOST." like '%".$QUERY_HOST."%'";

		if($QUERY_ACCOUNT != ''){
			$strSQL = $strSQL." and ".$_ACCOUNT."='".$QUERY_ACCOUNT."'";
		}
    } 		
	return $strSQL;
}
?>