Implement some very basic methods to prevent overloading

develop
Sven Slootweg 12 years ago
parent 1fbb21e6d8
commit 3f02174ba3

@ -25,13 +25,18 @@ else
$terms = explode(" ", $query);
$db_query_terms = array();
$valid_term = false;
foreach($terms as $term)
{
$db_query_terms[] = "`Title` LIKE ?";
$term = str_replace("%", "\%", $term);
$valid_term = $valid_term || (strlen($term) > 2);
$db_query_arguments[] = "%{$term}%";
}
if($valid_term)
{
$db_query = implode(" AND ", $db_query_terms);
array_unshift($db_query_arguments, '');
unset($db_query_arguments[0]);
@ -54,3 +59,10 @@ else
$sPageContents = json_encode(array("error" => "No results found for the specified query.", "query" => $query));
}
}
else
{
die(json_encode(array(
"error" => "No valid search query specified."
)));
}
}

Loading…
Cancel
Save