";
echo "";
echo "";
echo "";
echo "";
}
require_once "google.php";
require_once "tools.php";
require_once "config.php";
$page = isset($_REQUEST["p"]) ? (int) htmlspecialchars($_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
";
if ($type == 0) // text search
{
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 "";
if ($page != 0)
{
print_next_pages(0, "<<", $query);
print_next_pages($page - 10, "<", $query);
}
for ($i=$page / 10; $page / 10 + 10 > $i; $i++)
{
$page_input = $i * 10;
$page_button = $i + 1;
print_next_pages($page_input, $page_button, $query);
}
print_next_pages($page + 10, ">", $query);
echo "
";
}
else if ($type == 1) // image search
{
echo "";
foreach($results as $result)
{
$src = $result["base64"];
$alt = $result["alt"];
echo "
";
echo "";
echo "";
}
echo "
";
}
else if ($type == 2) // video search
{
echo "";
if ($config_replace_yt_with_invidious != null)
{
echo "
";
echo "YouTube results got replaced with a privacy friendly Invidious instance.";
echo "
";
}
foreach($results as $result)
{
$title = $result["title"];
$url = $result["url"];
$base_url = $result["base_url"];
echo "
";
}
echo "
";
}
?>