From 6d5fae51013ecf2a14fd68c36e83684e39beb625 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Fri, 13 Oct 2023 22:43:27 +0100 Subject: [PATCH] Add new search page. --- html/search.shtml | 116 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 html/search.shtml diff --git a/html/search.shtml b/html/search.shtml new file mode 100644 index 0000000..6ba52b8 --- /dev/null +++ b/html/search.shtml @@ -0,0 +1,116 @@ +"); + print (" "); + print (" "); + print (" "); + print (" "); + print ("
"); + print (" $message"); + if ($link == true) { + printf ("
Click here to retry your search."); + } + print ("
"); + print (""); + print ("
"); + } + + /* Construct the url */ + $url = "https://slackware.uk/cgi-bin/searchapi.cgi?"; + if (isset ($_GET[l])) { + $url = $url . "l=$_GET[l]&"; + } + if (isset ($_GET[p])) { + $url = $url . "p=$_GET[p]&"; + } else { + $url = $url . "p=/&"; + } + if (isset ($_GET[q])) { + $url = $url . "q=$_GET[q]"; + } else { + $url = $url . "q="; + } + + /* Query the search API */ + if ($fh = fopen ($url, "r")) { + /* Read and extract the status number */ + $status_line = stream_get_line ($fh, 0, "\n"); + $status = explode (":", $status_line); + if ($status[1] == "0") { +?> +
+ + + + +
+ Search Results

+ Search query:
+ Searches may contain multiple terms, include (basic) globs,
+ and descend down from the current directory. +
+
+ + + + + + + + + +
+ +
+
+ +$result_line
"); + $count++; + } + /* Output a total */ + if ($count == 0) { + print (" No results - try to widen your search."); + } elseif ($count == 1) { + print (" " . $count . " result found."); + } else { + print (" " . $count . " results found."); + } +?> +
+
+
+