From dc8f78256944885108f1d52b822c8677bf9d964c Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 12 Dec 2021 11:19:38 +0100 Subject: Initial commit --- icon/index.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 icon/index.php (limited to 'icon/index.php') diff --git a/icon/index.php b/icon/index.php new file mode 100644 index 0000000..97bf068 --- /dev/null +++ b/icon/index.php @@ -0,0 +1,46 @@ + $entry) { + $domain = explode("/", $entry["url"])[2]; + $sim = similar_text($domain, $_GET['q'], $perc); + if (substr($domain, 0, 4) === "www.") { + $domainstr = substr($domain, 4); + } else { + $domainstr = $domain; + } + $domains[] = [ + "id" => $id, + "url" => "https://" . $domain . "/", + "domain" => $domainstr, + "relevance" => $perc / 50 - 1 + ]; + } + + usort($domains, function($a, $b) { + return $a['relevance'] <=> $b['relevance']; + }); + + $domains = array_reverse($domains); + $icdom = $domains[0]['domain']; +} + +header("Location: https://external-content.duckduckgo.com/ip3/" . $icdom . ".ico"); +die(); \ No newline at end of file -- cgit