📄 search.php
字号:
<?
/*
-------------------------------------------------------- */
?>
<html>
<head>
<title><? echo $gbookname; ?></title>
<style type="text/css">
<!--
a:hover { font-family: "宋体"; font-size: 12px; color: #0000FF; text-decoration: none}
a:link { font-family: "宋体"; font-size: 12px; text-decoration: none; color: #333333}
a:visited { font-family: "宋体"; font-size: 12px; text-decoration: none; color: #333333}
td { font-family: "宋体"; font-size: 12px}
-->
</style>
</head>
<script language=javascript>
<!--
function mOvr(src){ if (!src.contains(event.fromElement)){src.bgColor = '#ffFFFF';src.children(0).style.color='#000000'}}
function mOut(src){ if (!src.contains(event.toElement)){src.bgColor = '#ebebeb';src.children(0).style.color='#000000'}}
-->
</script>
<body topMargin=5 bgcolor="#ffffff" text="#000000" link="#4682B4" vlink="#4682B4" background="img/lines.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td width="15"><img alt="" src="img/imac_scrn_1.gif" width="15" height="16" /></td>
<td background="img/imac_scrn_3.gif" width="100%"><img alt=""
src="img/spacer.gif" width="10" height="16" /></td>
<td width="16"><img alt="" src="img/imac_scrn_5.gif" width="16" height="16" /></td>
</tr>
<tr>
<td width="15" background="img/imac_scrn_9.gif"><img alt=""
src="img/spacer.gif" width="15" height="60" /></td>
<td align="center">
<?
$key=ltrim($key);
if (empty($key)||empty($user)){
echo "缺少关键条件 <a href='javascript:history.back();'>返回</a>";
exit();
}
if (!file_exists("data/$user")) {
echo "无此用户 <a href='javascript:history.back();'>返回</a>";
exit();
}
require("config.php");
function safe_convert($s) {
$s=str_replace("|","│",$s);
$s=str_replace("<","<",$s);
$s=str_replace(">",">",$s);
$s=str_replace("\r","",$s);
$s=str_replace("\t","",$s);
$s=str_replace("\n","<br>",$s);
$s=str_replace(" "," ",$s);
return $s; }
$key=trim($key);
$key=safe_convert($key);
@$fmsg=file("data/$user");
$count=count($fmsg);
$fp=fopen("temp","w");
flock($fp,2);
if($count>0){
for ($i=0;$i<$count;$i++) {
if (eregi($key,$fmsg[$i])){
fputs($fp,$fmsg[$i]);
}
}
}
fclose($fp);
@$msg=file("temp");
?>
<html>
<head>
<title><? echo $gbookname; ?></title>
<style type="text/css">
<!--
a:hover { font-family: "宋体"; font-size: 12px; color: #0000FF; text-decoration: none}
a:link { font-family: "宋体"; font-size: 12px; text-decoration: none; color: #333333}
a:visited { font-family: "宋体"; font-size: 12px; text-decoration: none; color: #333333}
td { font-family: "宋体"; font-size: 12px}
-->
</style>
</head>
<body bgcolor="B0C4DE" topmargin="0">
<script language=javascript>
<!--
function mOvr(src){ if (!src.contains(event.fromElement)){src.bgColor = '#ffFFFF';src.children(0).style.color='#000000'}}
function mOut(src){ if (!src.contains(event.toElement)){src.bgColor = '#ebebeb';src.children(0).style.color='#000000'}}
-->
</script>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="18%" height="11"> </td>
<td width="82%" align="center" height="11"> </td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
</table>
<br>
<table border=0 cellpadding=2 height=12 width="98%" align="center" bgcolor="#000000" cellspacing="1">
<tbody>
<tr bgcolor="#ebebeb">
<td height=6 width="100%">
<p align=center><font color=#2f5e8c>
</font><font color=#2f5e8c>[</font><a
href="gbook.php?user=<? echo $user; ?>"><font
color=#008000>签写留言</font></a><font color=#2f5e8c>] </font></p>
</td>
</tr>
<tr bgcolor="#ebebeb">
<form action=search.php?user=<? echo $user; ?> method=post>
<td height=34 width="100%">
<p align=center>搜索关键字:
<input name=key size="12" maxlength="20" style="background-color:#ffffff; color:#8888AA; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''">
<input name=submit type=submit value=留言搜索 style="color: #000000; background-color: #EEEEF8; border-style: solid; border-width: 0" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='EEEEF8'">
</p>
</td>
</form>
</tr>
</tbody>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td height="14" colspan="2"> <br>
<?
function show(){
global $offset,$user,$pagesize,$key,$msg;
$pathname="search.php";
if ($msg){
$total=count($msg);
$counter=0;
$lpp=$pagesize;
if ($dir=="") { $dir="下一页"; }
if ($offset<=0) { $offset=0; }
if ($dir=="下一页") {
if ($total > $lpp) {
$counter=$offset;
$offset+=$lpp;
$num=$offset;
if ($num > $total) {
$num=$total; } }
else {
$num=$total; } }
elseif ($dir=="上一页") {
if ($total > $lpp){
$offset-=$lpp;
if ($offset < 0){ $offset=0; }
$counter=$offset-$lpp;
if ($counter < 0){ $counter=0; }
$num=$counter+$lpp; }
else {
$num=$total; } }
$page_num=ceil($total/$lpp);
$preoffset=$offset-$lpp-$lpp;
$nextoffset=$offset;
print "<table border=0 cellpadding=0 cellspacing=1 width=98%>
<tr><td>找到符合条件的留言".$total."条 跳到第 ";
for($z=1;$z<=$page_num;$z++)
{$offset=($z-1)*$pagesize; echo "<a href='$pathname?user=$user&key=$key&offset=$offset'>$z</a>"."\n";}
print "页";
if ($total > $lpp) {
if ($nextoffset > $lpp) {
print "<a href=\"$pathname?user=$user&key=$key&offset=$preoffset\">上一页</a>\n"; }
if ($nextoffset < $total) {
print "<a href=\"$pathname?user=$user&key=$key&offset=$nextoffset\">下一页</a>"; }}
print "</td></tr></table>\n";
print "<table border=1 cellpadding=2 cellspacing=0 bordercolorlight=#008000
bordercolordark=#FFFFFF width=100%> ";
while ($counter<$num){
list($time,$name,$url,$text,$mail,$oicq,$date,$img,$ip)=explode("|",$msg[$counter]);
print "<table border=0 cellPadding=3 cellSpacing=1 height=8 width=\"98%\" align=\"center\" bgcolor=\"#000000\">
<tr>
<td bgcolor=#f7f7f7 rowSpan=3 valign=top width=155>
<table border=0 cellPadding=4 cellSpacing=0 width=\"100%\">
<tr>
<td align=middle width=\"41%\"><font color=#000000> </font></td>
<td align=middle width=\"17%\"><font color=#000000><img height=32 src=\"img/$img.gif\" width=32></font></td>
<td align=middle width=\"42%\"> </td>
</tr>
</table>
<P>姓名: <font color=#000000>$name</font><br>
来自: <font color=#000000>$ip</font><br>
邮件:<a href=\"mailto:$mail\" title=给".$name."发信>
<img border=0 src=\"coin/mail.gif\" width=\"15\" height=\"15\"> 邮件</a><br>
主页:<a href=\"$url\" target=_blank title=访问".$name."的主页>
<img border=0 src=\"coin/home.gif\" width=\"16\" height=\"16\"> 主页</a><br>
</P></td>
<td bgcolor=#ffffff width=503> <img height=16 src=\"coin/del.gif\" width=16>
发表于:$date
<tr>
<td onMouseOver=mOvr(this) onMouseOut=mOut(this); bgcolor=#ebebeb width=503 height=68 valign=\"top\"><font face=宋体>$text</font>
<tr>
<td bgcolor=#f7f7f7 width=503> <a href=\"mailto:$mail\" title=给".$name."发信>
<img border=0 src=\"coin/mail.gif\" width=\"15\" height=\"15\"> 邮件</a>
<a href=\"$url\" target=_blank title=访问".$name."的主页> <img border=0 src=\"coin/home.gif\" width=\"16\" height=\"16\"> 主页</a>
<img alt=".$name."的OICQ:".$oicq." height=16 src=\"coin/oicq.gif\" width=16> OICQ
<img alt=".$name."的IP地址是:".$ip." border=0 height=15 src=\"coin/ip.gif\" width=13> IP
<a href='reply.php?id=$time' title=回复该留言>
<img border=0 src=\"coin/replay.gif\"> 回复</a>
<a href='del.php?id=$time' title=删除该留言>
<img border=0 src=\"coin/del.gif\"> 删除</a></td>
</tr>
</table>";
$counter++;
}
print "<table border=0 cellpadding=0 cellspacing=1 width=98%>
<tr><td>找到符合条件的留言".$total."条 跳到第 ";
for($z=1;$z<=$page_num;$z++)
{$offset=($z-1)*$pagesize; echo "<a href='$pathname?user=$user&key=$key&offset=$offset'>$z</a>"."\n";}
print "页";
if ($total > $lpp) {
if ($nextoffset > $lpp) {
print "<a href=\"$pathname?user=$user&key=$key&offset=$preoffset\">上一页</a>\n"; }
if ($nextoffset < $total) {
print " <a href=\"$pathname?user=$user&key=$key&offset=$nextoffset\">下一页</a>"; }}
print " </TD>";
print "</table>";
}else{
echo "没找到相关留言";
exit();
}
}
show();
?>
<br>
</td>
</tr>
</table>
<div align="center">
<center>
<table width="20%" cellspacing="0" cellpadding="0">
<tr>
<td height="36" colspan="2" align="center" width="673">程序提供:<A HREF="http://yesoo.cpgl.net/" target=_blank><font color="#D7D7D7">
砀山网盟</font></a></td>
</tr>
</table>
</center>
</div>
</td>
<td width="16" background="img/imac_scrn_10.gif"><img alt=""
src="img/spacer.gif" width="15" height="60" /></td>
</tr>
<tr>
<td width="15"><img alt="" src="img/imac_scrn_13.gif" width="15" height="16" /></td>
<td background="img/imac_scrn_14.gif" width="100%"><img alt=""
src="img/spacer.gif" width="10" height="16" /></td>
<td width="16"><img alt="" src="img/imac_scrn_11.gif" width="16" height="16" /></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -