strlen($query) || strlen($query) > 256) { header("Location: /"); die(); } echo "value=\"$query\""; ?> >
"; ?>

count(explode(" ", $query))) // long queries usually wont return a wiki result thats why this check exists { require_once "results/special/wikipedia.php"; wikipedia_results($query_lower); return; } } function print_next_page_button($page, $button_val, $q, $type) { echo "
"; echo ""; echo ""; echo ""; echo ""; echo "
"; } function print_text_results($results) { global $query , $page; if ($page == 0) check_for_special_search($query); foreach($results as $result) { $title = $result["title"]; $url = $result["url"]; $base_url = $result["base_url"]; $description = $result["description"]; echo "
"; echo ""; echo "$base_url"; echo "

$title

"; echo "
"; echo "$description"; echo "
"; } } function print_image_results($results) { echo "
"; foreach($results as $result) { $src = $result["base64"]; $alt = $result["alt"]; echo ""; echo ""; echo ""; } echo "
"; } function print_video_results($results) { foreach($results as $result) { $title = $result["title"]; $url = $result["url"]; $base_url = $result["base_url"]; echo "
"; echo ""; echo "$base_url"; echo "

$title

"; echo "
"; echo "
"; } } $page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0; $type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0; $start_time = microtime(true); $results = get_google_results($query, $page, $type); $end_time = number_format(microtime(true) - $start_time, 2, '.', ''); echo "

Fetched the results in $end_time seconds

"; switch ($type) { case 0: print_text_results($results); break; case 1: print_image_results($results); break; case 2: print_video_results($results); break; default: print_text_results($results); break; } if ($type != 1 ) { echo "
"; if ($page != 0) { print_next_page_button(0, "<<", $query, $type); print_next_page_button($page - 10, "<", $query, $type); } for ($i=$page / 10; $page / 10 + 10 > $i; $i++) { $page_input = $i * 10; $page_button = $i + 1; print_next_page_button($page_input, $page_button, $query, $type); } print_next_page_button($page + 10, ">", $query, $type); echo "
"; } ?>
LibreX Source code & Other instances Donate ❤️