</td>
</tr>
</form>
</table>
</td>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form action=guest.php method=post>
<tr>
<td> 请输入关键字:
<input type="text" name="keyword" size="10">
<input type="submit" name="search" value="搜索留言">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<?
function search($keyword)
{
global $content;
$count=count($content);
$subscript=0;
$ArrSearch=array();
for ($i=0;$i<$count;$i++)
{
if (ereg($keyword,$content[$i]))
{
$ArrSearch[$subscript]=ereg_replace($keyword,"<font color=red>$keyword</font>",$content[$i]);
$subscript++;
}
}
return $ArrSearch;
}//end function
$one_page_line=15;
$content = file($guestfile);
if (isset($search) and isset($keyword) and $keyword!="")
{
$content=search($keyword);
}
$count =count($content);
?>
<table width="68%" border="0">
<tr>
<td>
<?
$int_page_count=$count;//总条数;
$int_page_num=ceil($int_page_count/$one_page_line);//总页数;
echo "<font color=#CC33FF>分页:";
for ($i=1;$i<=$int_page_num;$i++)
{
echo "<a href=guest.php?page=$i>".$i."</a> ";
}
echo "</font>";
if (isset($search) and isset($keyword) and $keyword!="")
{
echo "<br><center>";
echo "下面的留言中包含关键字<font color=red>$keyword</font>共<font color=red>".$count."</font>条</center>";
}
?>
</td><td><p align=right>共有<font color=red><?echo "$count"?></font>条</p></td>
</tr>
</table>
</div>
<br>
<table width="68%" border="0" align="center">
<?
if ($page=="" or !isset($page))
{$page=1;}
$text="";
$begin_line=$int_page_count-($page-1)*$one_page_line;
if ($begin_line<$one_page_line){$one_page_line=$begin_line;}
for ($j=$begin_line;$j>($begin_line-$one_page_line);$j--)
{
$text=$text."<tr><td align=right colspan=2><a href=reply.php?job=reply&record=".$j.">回复</a> <a href=edit.php?record=".$j.">编辑</a> <a href=dele.php?record=".$j.">删除</a> 第<font color=red>$j</font>条</td></tr>";
3/4 首页 上一页 1 2 3 4 下一页 尾页 |