diff options
-rw-r--r-- | search.php | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -10,7 +10,7 @@ try { if (!$config = parse_ini_file("config.ini")) { throw new Exception('Could not parse ini file'); } - + // hash the password if (isset($config['password'])) { $hash = hash("sha256", $config['password']); @@ -22,7 +22,7 @@ try { curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $output = json_decode(curl_exec($curl)); curl_close($curl); - + $search = read_stdin(); if (empty($search)) { @@ -65,18 +65,18 @@ try { throw new Exception("Page `" . $page . "` is not valid"); } - + // remove the pagination from the search args $pos = array_search("#" . $page, $args); if ($pos) { $args[$pos] = null; } - + // Really slow search $results = []; foreach ($output as $upload) { $match = false; - foreach ($args as $arg) { + foreach ($args as $arg) { if (!is_null($arg) && stripos($upload->filename, $arg) === false) { $match = false; break; @@ -121,7 +121,7 @@ try { } function read_stdin() -{ +{ $fr=fopen("php://stdin","r"); // open our file pointer to read from stdin $input = fgets($fr,128); // read a maximum of 128 characters $input = rtrim($input); // trim any trailing spaces. |