/*
Simple PHP wrapper for Perlfect Search (daniel.naber@t-online.de, 2003-03-13)
(a better wrapper would parse the result and access it via PHP)
To use this, you need to modify:
1. the search form, set this file's URL in the 'action' attribute
2. templates/search.html and templates/no_match.html: remove the
outer HTML code so it doesn't appear twice
3. conf.pl: set $SEARCH_URL to this file's URL
4. Set $search_url below
*/
$search_url = "http://localhost/cgi-bin/search/search.pl";
$url = $search_url."?";
$url .= "&p=".urlencode($_GET['p']);
$url .= "&lang=".urlencode($_GET['lang']);
$url .= "&include=".urlencode($_GET['include']);
$url .= "&exclude=".urlencode($_GET['exclude']);
$url .= "&penalty=".urlencode($_GET['penalty']);
$url .= "&mode=".urlencode($_GET['mode']);
$url .= "&q=".urlencode($_GET['q']);
$file = fopen($url, "r");
$result = fread($file, 100000);
fclose($file);
print $result;
/* Call this function of every output to avoid cross site scripting attacks: */
function strip_html($str) {
$str = stripslashes($str);
$str = preg_replace("/[<>\"'&]/", "", $str);
return $str;
}
?>