ok vi posto il codice completo... questo è il file col modulo di ricerca utente:
Codice PHP:
<form method="POST" action="NEWSEARCH.php">
<TABLE align="center">
<TR>
<TD width="381"><strong>Cerca nella categoria:</strong><br> <br>
<INPUT TYPE=radio name=where value=abbigliamento>
Abbigliamento<br> <INPUT TYPE=radio name=where value=alimentazione>
Alimentazione<br> <INPUT TYPE=radio name=where value=arredamento>
Arredamento<br>
</TD>
<TD width="90" rowspan=3> </TD>
</TR>
<TR>
<TD><strong>Parola chiave: </strong>
<input type="text" name="whatdoreplace" size="25">
<input type="submit" value="Cerca" name="B1"> </TD>
</TR>
<TR>
<TD> </TD>
</TR>
</TABLE>
</FORM>
questo invece è il file che "lavora" per fare la ricerca:
Codice PHP:
<b>Risultati della ricerca</b>
<hr width="70%">
<TABLE BORDER="1px" bordercolor="#000000" width=70% CELLPADDING=2 CELLSPACING=0>
<TR>
<TD bgcolor="#FFFFCC"><font face=Verdana size=1><b>La ricerca ha prodotto
i seguenti risultati:</b></font></TD>
</TR>
<?Php
error_reporting(0);
$timex=time();
$timey=0;
$bgchange="FFFFFF";
$fchek=0;
$command[0]="0";
$dirtest="false";
#subfolder search options setup starts here
if($where=="index"){
$dirtest="true";
$linkdir="";
$handle=opendir('.');
} elseif($where=="abbigliamento"){
$linkdir="abbigliamento/";
chdir('./abbigliamento');
$handle=opendir('.');
}elseif($where=="alimentazione"){
$linkdir="alimentazione/";
chdir('./alimentazione');
$handle=opendir('.');
}elseif($where=="arredamento"){
$linkdir="arredamento/";
chdir('./arredamento');
$handle=opendir('.');
} else {
$dirtest="true";
$linkdir="";
$handle=opendir('.');
}
#thats it, nothing else should be changed do not edit below this line.
while (($file = readdir($handle))!==false){
if (eregi("[a-zA-Z0-p_-]*.html",$file) or eregi("[a-zA-Z0-p_-]*.htm",$file)or eregi("[a-zA-Z0-p_-]*.php",$file)or eregi("[a-zA-Z0-p_-]*.txt",$file)){
$fchek=$fchek+1;
$sizer=filesize($file);
$sizer=($sizer/1000);
$sizer=round($sizer,1);
$file=trim($file);
$file=chop($file);
$filed=file($file);
$fileold=$file;
$count = count($filed);
$i = $count;
$zt = 0;
$clt=0;
$found=0;
$stringer=0;
for($j=$zt;$j<$i;$j++){
$string=$filed[$j];
$stringer=$filed[$j];
$num = "regPLACE hold";
$string=strtolower($string);
$stringer=strtolower($stringer);
$whatdoreplace=strtolower($whatdoreplace);
$string = ereg_replace($whatdoreplace, $num, $string);
if($string!=$stringer){
$found=$found+1;
$abby=$found;
$show[$found]=$stringer;
}
}
$dircount=count($file);
echo "<FONT SIZE=-1>";
if($found>0){
$command[0]=($command[0]+10);
if(eregi("[a-zA-Z0-p_-]*.txt",$file)){
$fileold=$file;
$file="index.php";
if($dirtest=="true"){
$file=$fileold;
}
}
if($file=="index.html"){
if($bgchange=="EEEEEE"){
$bgchange="FFFFFF";
echo "</TD></TR><TR><TD BGCOLOR=$bgchange><BR><A HREF=\"$linkdir$file\" >file</A><BR>$data <font face=Verdana size=1>Size: $sizer Kb</font><BR><BR><font face=Verdana size=2>Questa pagina contiene <FONT COLOR=RED><B>$found</B></FONT> volte la parola <FONT COLOR=RED><B>$whatdoreplace</B></FONT>:</font> <UL>";
} else {
$bgchange="EEEEEE";
echo "</TD></TR><TR><TD BGCOLOR=$bgchange><BR><A HREF=\"$linkdir$file\" class=cont>$fileold</A> <font face=Verdana size=1>Size: $sizer Kb</font><BR><BR><font size=2 class=testo>Questa pagina contiene <FONT COLOR=RED><B>$found</B></FONT> volte la parola <FONT COLOR=RED><B>$whatdoreplace</B></FONT>:</font> <UL>";
}
} elseif($bgchange=="EEEEEE"){
$bgchange="FFFFFF";
echo "</TD></TR><TR><TD BGCOLOR=$bgchange><BR><A HREF=\"$linkdir$file\">$fileold</A> <font face=Verdana size=1>Size: $sizer Kb</font><BR><BR><font size=2>Questa pagina contiene <FONT COLOR=RED><B>$found</B></FONT> volte la parola <FONT COLOR=RED><B>$whatdoreplace</B></FONT>:</font> <UL>";
} else {
$bgchange="EEEEEE";
echo "</TD></TR><TR><TD BGCOLOR=$bgchange><BR><A HREF=\"$linkdir$file\">$fileold</A> <font face=Verdana size=1>Size: $sizer Kb</font><BR><BR><font size=2>Questa pagina contiene <B><FONT COLOR=RED>$found</FONT></B> volte la parola <FONT COLOR=RED><B>$whatdoreplace</B></FONT>:</font> <UL>";
}
$file=$fileold;
for($new=1;$new<=$found;$new++){
$show[$new]=strip_tags($show[$new]);
$show[$new] = ereg_replace($whatdoreplace,"<FONT COLOR=RED><B>$whatdoreplace</FONT></B>",$show[$new]);
echo "<FONT SIZE=-1>";
print "<LI>$show[$new]";
}
echo "</UL></FONT></TD></TR>";
}
}
}
if($command[0]==0){
echo "<BR></TD></TR><TR><TD bgcolor=000000><CENTER><FONT FACE=VERDANA SIZE=5 color=red><b>Nessuna parola trovata!</b></font></center>";
}
echo "<BR></TD></TR><TR><TD BGCOLOR=3399ff><LEFT><font face=Veradna size=1><b>Ricerca effettuata su $fchek pagine e in circa ";
$timey=time();
$timea=($timey-$timex);
echo " $timea secondi.</b></font></left>";
?>
</TD></TR></TABLE>
grazie 1000!