fixed strpos bug that caused searches to fail

main
BuildTools 4 years ago
parent 864d556a53
commit eccb69835f
  1. 2
      instance.php
  2. 3
      routes.php

@ -31,7 +31,7 @@ class ml
} }
function run() function run()
{ {
echo(route($_SERVER["PATH_INFO"], $this)); echo(route(explode("?", $_SERVER["REQUEST_URI"])[0], $this));
} }
} }
?> ?>

@ -4,7 +4,7 @@ function substrInArr($needle, $haystack)
{ {
foreach ($haystack as $str) 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; return true;
} }
@ -66,6 +66,7 @@ function route($path, $ml)
default: default:
http_response_code(404); http_response_code(404);
echo("404 not found");
} }
} }
?> ?>
Loading…
Cancel
Save