# The latest version is at http://grolsch.solbors.no/phpsearchbox/ # # 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 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. # #$Id: phpsearchbox.php,v 1.17 2001/04/05 06:03:31 remco Exp $ # Your preferred search engine $favorite = "choose"; # use $PATTERN to let phpsearchbox looks like you want # %SEARCHBUTTON% : is the "button" ;-) # %SEARCHTEXT% : is the input area ;-) # %SEARCHENGINE% : is the select engine area ;-) if (!isset($PATTERN)) { $PATTERN = "%SEARCHENGINE%
%SEARCHTEXT%
%SEARCHBUTTON%" ; } # Text that will appear in search button if (!isset($buttontext)) { $buttontext = "search"; } # Change this to the URL where this script is located $script_url = "/phpsearchbox.php"; # relative path to the search engines' file (relative from $script_url path) $enginesfile = "phpsearchengines.php" ; # Where to send if no query was entered $searchbox_orgurl = "/"; # Which searchengines do you want included? $searchengines = array("choose","UTNetCAT","UTNetCATtb","UTNetCATtk","UTNetCATab","UTNetCATak","UTNetCATsi","UTNetCATsk","UTNetCATmk","UTNetCATcb","UTLOL","UTAustin","alltheweb","altavista","google","hotbot","imdb","lycos","northernlight","webcrawler","yahoo"); ### NO CHANGES NEEDED UNDER THIS LINE # Import searchengine definitions if (basename($script_url) != basename($SCRIPT_NAME)) { # if we have been called from an alternate script, then we must use absolute path call if (!strstr(basename($script_url),'/')) { include $enginesfile; } else { include dirname($script_url).$enginesfile ; } } else { # else relative path, because we can't know absolute path ($script_url might be # a relative path from our caller) include $enginesfile ; } if ($query == "") { if ($engine) { // if we click on the search button without providing a query : redirect to correct page header ("Location: $searchbox_orgurl"); } else { print ("
"); $searchtext__ = "\n"; $searchengine__ = ""; if(!$buttontext == "") { $searchbutton__ = "\n"; } $PATTERN = preg_replace("|%SEARCHBUTTON%|", $searchbutton__, $PATTERN) ; $PATTERN = preg_replace("|%SEARCHTEXT%|", $searchtext__, $PATTERN) ; $PATTERN = preg_replace("|%SEARCHENGINE%|", $searchengine__, $PATTERN) ; print ($PATTERN); print ("
"); } } else { while (list ($key, $val) = each ($searchengines)) { if ($val == $engine){ $searchengine = $phpsearchbox[$engine]["querystring"]; header ("Location: " . $searchengine . urlencode($query)); } } } ?>