Ops, perdona, si es que se me va la olla, te paso el codigo:
<?
$pp=10;
$start=intval($start);
$o=intval($o);
$q=mhtml($q);
$title=$q;
function hl($str) {
GLOBAL $lq;
$str=" ".$str;
$ph=explode(" ",$lq);
$lstr=mysql_result(mysql_query("SELECT lower('$str')"),0,0);
for ($i=0;$i<count($ph);$i++) {
$lstr=eregi_replace($ph[$i],"<b><font color=red>".$ph[$i]."</font></b>",$lstr);
}
$p1=1;$p2=1;
while ($p1!=0 && $p2!=0) {
if (($p1=strpos($lstr,"<b><font color=red>"))!=0) {
$lstr[$p1]="|";
$str=substr($str,0,$p1)."<b><font color=red>".substr($str,$p1);
if (($p2=strpos($lstr,"</font></b>"))!=0) {
$lstr[$p2]="|";
$str=substr($str,0,$p2)."</font></b>".substr($str,$p2);
}
}
}
$str=substr($str,1);
return($str);
}
$template=$TMPL["brokenscript"];
$template=str_replace("%YESTEXT",$LANG["yes"],$template);
$template=str_replace("%NOTEXT",$LANG["no"],$template);
$template=str_replace("%BROKENSURETEXT",$LANG["brokensure"],$template);
print $template;
$sform=$TMPL["searchform"];
$sform=str_replace("%SEARCHTEXT",$LANG["search"],$sform);
$sform=str_replace("%QUERYTEXT",$q,$sform);
print $sform;
$q=trim($q);
if (empty($q)) {
print "<P><font color=red>".$LANG["emptyquery"]."</font></P>";
$total=0;
}
else {
$order="ORDER BY gin DESC,gout DESC";
if ($o==1) $order="ORDER BY title";
if ($o==2) $order="ORDER BY moder_vote DESC";
$lq=mysql_result(mysql_query("SELECT lower('$q');"),0,0);
$uq=mysql_result(mysql_query("SELECT upper('$q');"),0,0);
$likes="";
$ph=explode(" ",$uq);
for ($i=0;$i<count($ph);$i++) {
$pq="%".$ph[$i]."%";
$likes.=" OR UPPER(description) like '$pq'";
$likes.=" OR UPPER(title) like '$pq'";
$likes.=" OR UPPER(url) like '$pq'";
}
$likes=substr($likes,4);
$rr=mysql_query("SELECT count(*) FROM main WHERE type=1 AND ($likes)") or die(mysql_error());
$total=mysql_result($rr,0,0);
$r=mysql_query("SELECT * FROM main WHERE type=1 AND ($likes) $order LIMIT $start,10") or die(mysql_error());
$c=mysql_num_rows($r);
$template=$TMPL["searchtop"];
$template=str_replace("%STARTNUM",$start+1,$templa te);
print $template;
while ($ar=mysql_fetch_array($r)) {
$admin="";
if (isset($sid)) {
$admin.="<font color=black size=-3> [<a href=admin/edit.php?lid=".$ar["lid"]."&type=255 class=slink>".$LANG["edit"]."</a>] [";
for ($j=1;$j<11;$j++) {
if ($j==$ar["moder_vote"]) $admin.="<B>".$j."</B> ";
else $admin.="<a href=admin/vote.php?lid=".$ar["lid"]."&vote=$j&type=255 class=slink>".$j."</a> ";
}
$admin.="]</font>";
}
$template=$TMPL["linksbit"];
$template=str_replace("%ID",$ar["lid"],$template);
$template=str_replace("%TITLE",hl($ar["title"]),$template);
$template=str_replace("%GIN",$ar["gin"],$template);
$template=str_replace("%GOUT",$ar["gout"],$template);
$template=str_replace("%MODERVOTE",$ar["moder_vote"],$template);
$template=str_replace("%DESC",hl($ar["description"]),$template);
$template=str_replace("%BEST","<img src=./cat/star.gif width=15 height=16 hspace=3>",$template);
$template=str_replace("%BOROKENTEXT",$LANG["broken"],$template);
$template=str_replace("%ADMINIFACE",$admin,$templa te);
print $template;
}
$template=$TMPL["searchbottom"];
}
if ($c==0) {
print "<P>".$LANG["notfound"]."</P>\n";
}
print "<table cellspacing=0 cellpadding=0 border=0 width=100% bgcolor=#E0E0E0><tr><td><img src=/images/none.gif width=1 height=1></td></tr></table>";
print "<P>".$LANG["pagesfound"].": <B>".$total."</B>";
if ($total>$pp) {
print "<center><br>";
if ($start!=0) print "<a href=./search.php?o=$o&start=0&q=".urlencode($q)."><&l t;</a> | ";
else print "<< | ";
$sstart=$start-60; if ($sstart<0) $sstart=0;
$send=$start+60;if ($send>$total) $send=$total;
for ($i=$sstart;$i<$send;$i+=$pp) {
if ($start==$i)
print "<b>".($i+1)."</b>";
else
print "<a href=./search.php?o=$o&start=$i&q=".urlencode($q).">".($i +1)."</a>";
print " | ";
}
if ($start==$total-$pp)
print ">>";
else
print "<a href=./search.php?o=$o&start=".($i-$pp)."&q=".urlencode($q).">>></a>";
print "</center>";
}
print "<br>";
?> |