From eccb69835f5c6651782af4f98a218d23536e0194 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 16 May 2021 14:41:45 -0400 Subject: [PATCH] fixed strpos bug that caused searches to fail --- instance.php | 2 +- routes.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/instance.php b/instance.php index 2a01f48..b7d50d5 100644 --- a/instance.php +++ b/instance.php @@ -31,7 +31,7 @@ class ml } function run() { - echo(route($_SERVER["PATH_INFO"], $this)); + echo(route(explode("?", $_SERVER["REQUEST_URI"])[0], $this)); } } ?> \ No newline at end of file diff --git a/routes.php b/routes.php index 751e359..8352b10 100644 --- a/routes.php +++ b/routes.php @@ -4,7 +4,7 @@ function substrInArr($needle, $haystack) { foreach ($haystack as $str) { - if (strpos($str, $needle)) + if (strpos($str, $needle) !== false) //it return 0 if that's the index and false if there is no index, so we need the !== false { return true; } @@ -66,6 +66,7 @@ function route($path, $ml) default: http_response_code(404); + echo("404 not found"); } } ?> \ No newline at end of file