Ok, I have a search. I included the file “search.php” on my “home.php”, but for people to be able to search, the adress has to be search.php. For example, if you are on searching on “search.php” it will go something like “search.php?keyword=kirupa”. But since I included it in my home, it does not work! Help please. Here is the code for the result page:
<? require ("language.php"); ?>
<font face="verdana"><center><font size="4"><? echo $ptitolo; ?></font>
<?
if ($keyword != "")
{
$keyword = eregi_replace("\+", " ", $keyword);
$keyword = eregi_replace("\-", " ", $keyword);
$keyword = eregi_replace("\"", " ", $keyword);
$keyword = eregi_replace(" +", " ", $keyword);
$newkey = explode(" ", $keyword);
?><p> </p><table width="100%" cellspacing="0" cellpadding="0" border="0"><?
require("class.recfind.php");
$totale = "0";
$color="1";
$color1="#E9E9E9";
$color2="#D7D7D7";
for ($i = 0; $i <= sizeof($newkey); $i++) {
$real = "0";
$engine=new RecursiveSearch();
$engine->setQuery("$newkey[$i]");
$engine->isCaseSensitive(false);
$found=$engine->search();
foreach ($found as $value)
{
$checkvalue = parse_url($value);
$checkvalue = $checkvalue[path];
if (eregi("/[a-zA-Z0-p_-]*.php",$checkvalue) or eregi("/[a-zA-Z0-p_-]*.php",$checkvalue))
{
$titolo = "No Title";
$quotation = "No Description";
$filet=join("",file("$value"));
if (preg_match("/<title.*>(.*)<\/title.*>/isU", $filet, $match))
$titolo = trim($match[1]);
$rintraccia = array ("'<script[^>]*?>.*?</script>'si",
"'<[\/\!]*?[^<>]*?>'si",
"'([
])[\s]+'",
"'&(quot|#34);'i",
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&#(\d+);'e");
$correggi = array ("",
"",
"\\1",
"\"",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169),
"chr(\\1)");
$htmtext = preg_replace ($rintraccia, $correggi, $filet);
$regexpcontext='/(.{40})'.preg_quote($var).'(.{20})/isU';
if (preg_match($regexpcontext, $htmtext, $match2))
$quotation = trim($match2[1]);
if ($titolo != "No Title")
{
if ($color == "1") {
echo "<tr width=\"100%\" bgcolor=\"$color1\"><td> </td></tr>";
echo "<tr width=\"100%\" bgcolor=\"$color1\"><td>";
$color = "2";
} else {
echo "<tr width=\"100%\" bgcolor=\"$color2\"><td> </td></tr>";
echo "<tr width=\"100%\" bgcolor=\"$color2\"><td>";
$color = "1";
}
echo "<font face=\"verdana\" size=\"-2\"><a href=\"$value\">".$titolo."</a><br><br>";
echo "<i>...$quotation...</i></font></td></tr>";
$real = $real + 1;
}
$titolo = "No Title";
$quotation = "No Description";
}
}
$totale = $totale + $real;
}
echo "</table>";
if ($totale > 0)
{
echo "<p><center>$ttrovati <b><font color=red>".$totale."</font></b> $tfile <font color=red>$keyword</font></b></center><br><br>";
} else {
echo "<br><br><center><font color=\"red\" size=\"2\"><b><i>$tnofile</i></b></font></center>";
}
$keyword = "";
} else {
echo "<p> </p><br><br><center><font color=\"red\" size=\"2\"><b><i>$tinvalido</i></b></font></center>";
}
?>
</font>
I included the file search.php in my home, and the actions for the form of search.php is results.php. And when I type, I just want it to be able to search and go to results.php?keyword=blalblabla
Thanks in advance,
Nico.