diff --git a/HawkEye Interface/interface.php b/HawkEye Interface/interface.php index 46efaf2..b88b791 100644 --- a/HawkEye Interface/interface.php +++ b/HawkEye Interface/interface.php @@ -119,8 +119,27 @@ array_push($args, "`timestamp` <= '" . $data["dateTo"] . "'"); if ($data["keywords"][0] != "") { foreach ($data["keywords"] as $key => $val) + if($data["block"] != "00") //check if dealing with a block, or an entered string + { + //In SQL syntax, %SEARCH_STRING%, % matches everything, even digits. + //regexp is needed to avoid matching 156 for a 56 search. + $data["keywords"][$key] = "'(^|[^0-9^:^~^x])" . $val . "($|[^0-9^x^-])'"; + //above is negation, bellow I saved my example for inclusion + //$data["keywords"][$key] = "'( |(^|@)([+]|[-])|^|[0-9]-)" . $val . "(~|$|:)'"; + //chest transaction "@(-|+)ID(:|~)" + //pick/drop item " ID(:|$)" + //place/break "(^|-)ID(:|$)" + //edit: place is in format "formerblock-currentblock" + //happy xray hunting. + } + else //if not, continue normal operation + { $data["keywords"][$key] = "'%" . $val . "%'"; - array_push($args, "`data` LIKE " . join(" OR `data` LIKE ", $data["keywords"])); + } + if($data["block"] != "00") //again, if a block, do a REGEXP + array_push($args, "`data` REGEXP " . join(" OR `data` REGEXP ", $data["keywords"])); + else //if dealing with an entered string, do a LIKE seach with the already completed %% request + array_push($args, "`data` LIKE " . join(" OR `data` LIKE ", $data["keywords"])); } if ($data["exclude"][0] != "") { foreach ($data["exclude"] as $key => $val) @@ -288,4 +307,4 @@ function error($message) { echo json_encode($output); } -?> \ No newline at end of file +?>