X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/58747947711a7113fa7ca73efd751d97f18ec464..eed1ade0e1c8b5340d9619c8fb6b4a08d230f3e9:/api/search.php diff --git a/api/search.php b/api/search.php index c54d7f8..9b78452 100644 --- a/api/search.php +++ b/api/search.php @@ -35,9 +35,13 @@ $search_results = [ function strcasestr($haystack, $needle) : bool { - if (strstr(strtolower($haystack), strtolower($needle))) - return true; - return false; + $needle = strtolower($needle); + $haystack = strtolower($haystack); + $needle = preg_quote($needle, '/'); + $needle = str_replace('\*', '.*', $needle); + $pattern = '/.*' . $needle . '.*' . '/'; + + return preg_match($pattern, $haystack) === 1; } foreach ($users as $u) {