Jump to content


y3k

Member Since 14/06/2004
Offline Last Active 27/10/2006, 23:06
-----

Topics I've Started

Aew Me Ajuda No Sistema De Busca!

25/09/2004, 18:33

Ta aew o codigo espero que alguem saiba me ajudar, to querendo que o sistema faça a busca em mais de um arquivo, tipow ele faz a busca no arquivo site.txt eu quero q ele faça a busca em 4 arquivo... site.txt , site2.txt , site3.txt e site4.txt :( alguem pode me ajudar? :) muito grato valeu aew! ;) meu email é juniormartins#brazil.com tks! ;)

esse é o arquivo buscar.php :) :unsure:

<?
if($action == "buscar") {

include "config.php";
$filename = "db/site.txt";

if(strlen($keyword) <= 3){
print "<p><b>A palavra deve ter no mínimo 3 letras</b><br>";
}
else{

function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}


$user = file("$filename");
$searching = count($user);
$lis = 0;
for($x=0;$x<sizeof($user);$x++) {
$temp = explode("|",$user[$x]);
$line[$x] = "$temp[0]";

$keyword = trim($keyword, " ");
$keywords = explode(" ", $keyword);


foreach ($keywords as $word){
if(stristr($temp[0], $word) || stristr($temp[0], $word)) {
$collect[$lis] = $line[$x];
$lis++;
}
}
}

$time = microtime();
$time = number_format($time,3);

if($lis > 0){
$list = array_values(array_unique($collect));
}
else $list = $collect;
//var_dump($list);


if(sizeof($list) != "0") {

//sort($keyword);
echo "<p><b>",sizeof($list),"</b> Resultados da pesquisa para <b>$keyword</b></p></font>";

for($y=0;$y<sizeof($list);$y++) {
$temp = explode("|",$list[$y]);
echo '<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-bottom-width: 0" bordercolor="#CCCCCC" width="100%" id="AutoNumber1">
<tr>
<td width="100%" height="20" bgcolor="#EEEEEE" style="border-bottom-style: none; border-bottom-width: medium">
<font size="2" face="Arial">&nbsp;<img src="gfx/ico_seriais.gif" width="14" height="7">&nbsp;',$temp[0],'</font></td>
</tr>
</table>';
}
if($stats == true){
echo "<p>Foram pesquisadas <b> $searching </b> páginas | A pesquisa durou <b>$time</b> segundos.<br><br>";
}
}

else{
echo "<p>Nenhuma ocorrência para a palavra digitada<b>$keyword.<br> Por favor, tente novamente</b><br><br>";
if($stats == true){
echo "A pesquisa durou<b>$time</b>segundos.<br>";
}
}

?>
<form action="<? echo ($_SERVER['PHP_SELF']); ?>" method="post">
<input type="text" name="keyword" size="40" maxlength="100">
<input type="submit" name="submit" value=" Buscar ">
<input type ="hidden" name="action" value ="buscar">
</form>
<?
}
}
else if(!$action || $action == ""){
?>
<form action="<? echo ($_SERVER['PHP_SELF']); ?>" method="post">
<input type="text" name="keyword" size="40" maxlength="100">
<input type="submit" name="submit" value=" Buscar ">
<input type ="hidden" name="action" value ="buscar">
</form>
<?
}
?>
<center>
</center>

============================================
termino ;)

IPB Skin By Virteq