/* terraserver.de/search-0.2-11.04.2002 - https://www.terraserver.de/ Copyright (C) 2002 Holger Eichert, mailto:h.eichert@gmx.de. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License https://www.gnu.org/copyleft/gpl.html for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Abbout: Some people say php is not the language to do a fulltextsearch and they are right ;-) but anyway: terraserver.de/search performs a realtime fulltext-search over spezified directorys including subdirectorys and returns a link and an extract of each file. htmlspecialchars are supported so a search for "�ber" will return documents having "über" as well as documents having "�ber". Changes: - Added some more features like 'match case' and the possibility to limit the number of results. Configure: Comment/Uncomment your language configuration and if necessary edit the settings. Have fun... */ // English Configuration $my_server = "https://".getenv("SERVER_NAME").":".getenv("SERVER_PORT"); // Your Server (generally no changes needed) $my_root = getenv("DOCUMENT_ROOT"); // Your document root (generally no changes needed) $s_dirs = array(""); // Which directories should be searched ("/dir1","/dir2","/dir1/subdir2","/Verzeichniss2/Unterverzeichniss2")? --> $s_dirs = array(""); searches the entire server $s_skip = array("..",".","subdir2"); // Which files/dirs do you like to skip? $s_files = "html|htm|HTM|HTML|php3|php4|php|txt"; // Which files types should be searched? Example: "html$|htm$|php4$" $min_chars = "3"; // Min. chars that must be entered to perform the search $max_chars = "30"; // Max. chars that can be submited to perform the search $default_val = "Searchphrase"; // Default value in searchfield $limit_hits = array("5","10","25","50","100"); // How many hits should be displayed, to suppress the select-menu simply use one value in the array --> array("100") $message_1 = "Invalid Searchterm!"; // Invalid searchterm $message_2 = "Please enter at least '$min_chars', highest '$max_chars' characters."; // Invalid searchterm long ($min_chars/$max_chars) $message_3= "Your searchresult for:"; // Headline searchresults $message_4 = "Sorry, no hits."; // No hits $message_5 = "results"; // Hits $message_6 = "Match case"; // Match case $no_title = "Untiteled"; // This should be displayed if no title or empty title is found in file $limit_extracts_extracts = ""; // How many extratcts per file do you like to display. Default: "" --> every extract, alternative: 'integer' e.g. "3" $byte_size = "51200"; // How many bytes per file should be searched? Reduce to increase speed /* // Deutsche Konfiguration $my_server = "https://".getenv("SERVER_NAME").":".getenv("SERVER_PORT"); // Zu durchsuchender Server $my_root = getenv("DOCUMENT_ROOT"); // Wurzelverzeichnis fuer die Suche $s_dirs = array("/search/dir1","/search/dir2"); // Welche Verzeichnisse ("/Verzeichniss1","/Verzeichniss2","/Verzeichniss2/Unterverzeichniss1","/Verzeichniss2/Unterverzeichniss2") im Wurzelverzeichnis sollen durchsucht werden? --> $s_dirs = array(""); durchsucht den ganzen Server $s_skip = array("..",".","subdir2"); // Welche Ordner oder Dateien sollen ausgelassen werden? $s_files = "html|htm|HTM|HTML|php3|php4|php|txt"; // Welche Dateien (Endung) sollen durchsucht werden? Beispiel fuer mehrere Endungen: "html$|htm$|php4$" $min_chars = "3"; // Wieviel Zeichen muessen mind. bei der Suche eingegeben werden? $max_chars = "30"; // Wieviel Zeichen duerfen max. bei der Suche eingegeben werden? $default_val = "Begriff"; // Default Wert im Suchfeld $limit_hits = array("5","10","25","50","100"); // Max. Treffer anzeigen, um das select-menue zu unterdruecken und beispielsweise max. 100 Treffer anzuzeigen --> array("100") $message_1 = "Ungültiger Suchbegriff!"; // Zuwenig/zuviel Zeichen in der Suche $message_2 = "Bitte geben Sie mindestens '$min_chars', maximal '$max_chars' Zeichen ein, zusammenhängende Begriffe durch ein Leerzeichen getrennt."; // Ungueltige Suchanfrage ($min_chars/$max_chars) $message_3= "Suchergebnisse für:"; // Ueberschrift Suchergebnisse $message_4 = "Die Suche ergab leider keinen Treffer."; // Keinen Treffer $message_5 = "Treffer"; // Treffer $message_6 = "Gro�-/Kleinschreibung beachten"; // Gro�-/Kleinschreibung beachten $no_title = "Ohne Titel"; // Kein Titel in Datei $limit_extracts = ""; // Wieviele Treffer (Auszuege) sollen _pro Dokument_ ausgegeben. Default: "" also alle, Alternativ: 'Zahl' z.B. "2" $byte_size = "51200"; // Wieviel byte sollen pro zu durchsuchender html-Datei durchsucht werden (Je kleiner, desto schneller die Suche, desto geringer die Chance auf einen Treffer --> html-Dateien sollten eigentlich nicht groesser als 10 KB, also 10240 byte sein) Default: '51200', weil grosse Dateien vorhanden? */ //ini_set("error_reporting", "2047"); // Debugger // search_form(): Gibt das Suchformular aus function search_form($HTTP_GET_VARS, $limit_hits, $default_val, $message_5, $message_6, $PHP_SELF) { @$keyword=$HTTP_GET_VARS['keyword']; @$case=$HTTP_GET_VARS['case']; @$limit=$HTTP_GET_VARS['limit']; echo "
\n"; } // search_headline(): Ueberschrift Suchergebnisse function search_headline($HTTP_GET_VARS, $message_3) { @$keyword=$HTTP_GET_VARS['keyword']; @$action=$HTTP_GET_VARS['action']; if($action == "SEARCH") // Volltextsuche echo "$message_1
$message_2
$message_4
"; } ?>