用Java+MySQL+PHP轻松构建跨平台的搜索引擎 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-23
/div>
</th>
<td nowrap>
</td>
</tr>
<tr bgcolor="#FF0000">
<th nowrap colspan="2" height="3"></th>
</tr>
<?php while($row= mysql_fetch_array($result)){
$Pos=$row[0];
$FindCount++;
if($FindCount>20) break;?>
<tr>
<td nowrap colspan="2">
<?php echo $FindCount;?>
<a href="<?php echo $row[1]?>" target=_black>
<?php if($row[2]!="") echo $row[2];
else echo substr($row[3],0,64);
?>
</a></td>
</tr>
<tr>
<td colspan="2" ><span class="pt13">摘要:</span>
<?php
if($SearchIn=="Title") {
$ZhaiYao=substr($row[3],0,1024);
}
else{
if($Speed=="Fast") $ZhaiYao=$row[3];
else{
$RowLen=strlen($row[3]);
if ($RowLen<1024) {
$ZhaiYao=$row[3];
}
else {
$CutPos=0;
$PosWord1=strpos($row[3],$Words[0]);
if($PosWord1-512<0) $ZhaiYao=substr($row[3],0,1024);
else {
for($i=24;$i<500;$i++){ //避免将中文字符从半个字处截断,选择从英文处截断
if(ord(substr($row[3],$PosWord1-$i,1))<128) {$CutPos=$i;break;}
}
$ZhaiYao=substr($row[3],$PosWord1-$CutPos,1024);
}
}
}
for($i=0;$i<count($Words);$i++){
$ZhaiYao=str_replace($Words[$i],"<font color=red>".$Words[$i]."</font>", $ZhaiY
ao);
}
}
echo $ZhaiYao;
?>
</td>
</tr>
<tr>
<td colspan="2" align="right"><a href="One.php?num=<?php echo $row[0]?>" tar
get=_black>
<font color="#0033FF" class="pt12">本地镜像</font></a></td>
</tr>
<tr bgcolor="#999933">
<td nowrap colspan="2" height="1"></td>
</tr>
<?php } ?>
<?php if($RowCount>20){ ?>
<tr>
<td align="right" colspan="2" height="10">
<form name="form2" method="post" action="Search.php">
<input type="hidden" name="KeyWords" value="<?php echo $KeyWords;?>">
<input type="hidden" name="SearchIn" value="<?php echo $SearchIn;?>">
<input type="hidden" name="Speed" value="<?php echo $Speed;?>">
<input type="hidden" name="CurPos" value="<?php echo $Pos;?>">
<input type="submit" name="Submit" value="下20个网页">
</form>
</td>
</tr>
<?php } ?>
</table>
One.php用于从本地镜像中显示一个找到的网页。由于网页的原始信息已经在WebPageLocal中存储,所以 只需简单的读出,发给用户。 <?php mysql_connect("localhost","root","mypassword"); $sql="select Url,Content from WebPageLocal where "; if($num!="") $sql=$sql."Id=$num"; else exit(); $result=mysql_db_query("Spider",$sql); $mt=mysql_fetch_row($result); echo $mt[1]; ?> |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: 品味Java子类型多态的魅力 - 编程入门网下一篇: Java中的模式 - 编程入门网
关于用Java+MySQL+PHP轻松构建跨平台的搜索引擎 - 编程入门网的所有评论