diff options
Diffstat (limited to 'prog/sear.php')
-rw-r--r-- | prog/sear.php/index.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/prog/sear.php/index.php b/prog/sear.php/index.php index cd684b8..487e29d 100644 --- a/prog/sear.php/index.php +++ b/prog/sear.php/index.php @@ -218,6 +218,8 @@ function handle_response ($query, $response, $limit, $plaintext, $horseshoe, $ad $resultshtml = results_html($response["results"], $plaintext, $limit); die(template($response["query"], $queryinfo, $resultshtml, $response["query"], $add_form, $image)); } +if (!isset($_REQUEST["debug"])) + ini_set('display_errors','Off'); $add_form = ""; $add_url = ""; $q = null; @@ -234,7 +236,10 @@ if (!empty($_REQUEST["e"])) { } if (!empty($_REQUEST["json"])) { header("Content-Type: application/json"); - die(json_encode(query_google($q, $image, $exact))); + $response = query_google($q, $image, $exact); + if ($response["status"] == false) + http_response_code(500); + die(json_encode($response)); } $limit = false; if (!empty($_REQUEST["l"])) { @@ -295,12 +300,15 @@ if ($response["status"] != true) { if ($json["status"] == false) { if ($json["code"] == "captcha") continue; + http_response_code(500); die(template("napaka", "napaka pri posredovanju zahteve", "ker je poizvedba vrnila captcho, sem jo posredoval na drug strežnik, ta pa je vrnil napako " . $json["code"] . ".", $q)); } handle_response($q, $json, $limit, $plaintext, $horseshoe, $add_url, $add_form, $image); } + http_response_code(500); die(template("napaka", "iskalno zaledje omejuje iskanja", "iskalno zaledje se je odzvalo s CAPTCHO, češ, da ta instanca prehitro pošilja zahteve. obenem se je enako zgodilo tudi vsem rezervnim strežnikom. iščete lahko ročno preko spletne strani zaledne storitve: <a href='" . htmlspecialchars($response["url"]) . "'>kliknite sem</a>.", $q)); } + http_response_code(500); die(template("napaka", "napaka pri poizvedbi", "poizvedba na iskalno zaledje je vrnila napako " . $response["code"] . ".", $q)); } handle_response($q, $response, $limit, $plaintext, $horseshoe, $add_url, $add_form, $image); |