⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guestbook.asp

📁 一个不错的个人商务网站的源码
💻 ASP
字号:
<%
'option explicit
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True 
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache" 
'主要是使随机出现的图片数字随机
%>
<!--#include file="db_conn.asp"-->
<!--#include file="comm/comm.asp"-->
<!--#include file="comm/sub.asp"-->
<!--#include file="comm/pages.asp"-->
<!--#include file="comm/my_lib.asp"-->
<!--begin TOP-->
<%
'说明 head(a,b,c)
'a为页标题
'b为页描述
'c为页关键字

call head(r(26)&"-留言本",r(27),r(28))
flag=cint(my_request("flag",1))
keyword=my_request("keyword",0)
%>
<!--end TOP-->
<SCRIPT language="javascript">
<!--
function checksubmit()
{
 if (document.form1.username.value == "")        
  {        
    window.alert("称呼不能为空!");        
    document.form1.username.focus();        
    return (false);} 
     if (document.form1.usercontent.value == "")        
  {        
    window.alert("留言内容不能为空!");        
    document.form1.usercontent.focus();        
    return (false);}
    if (document.form1.usercontent.value.length>255)
  {window.alert('您的留言内容太长,只允许255字以内');
  document.form1.usercontent.focus();
  return false;}
if (document.form1.safecode.value == "")        
  {        
    window.alert("验证码不能为空!");        
    document.form1.safecode.focus();        
    return (false);}
    }
  //--></SCRIPT>
<div align="center">
<table border="0" width="760" cellpadding="0" style="border-collapse: collapse">
	<tr>
		<td width="182" valign="top"><!--#include file="left.asp"--> </td>
		<td width="15" valign="top"> </td>
		<td width="563" valign="top">
	
		<table border="0" width="563" id="table1" cellpadding="0" style="border-collapse: collapse">
			<tr>
				<td width="72" class="topmanu_bg" height="20">
				<p align="center">网友留言</td>
				<td width="490" height="13">
				<p align="left">&nbsp;</td>
			</tr>
			<tr>
				<td width="563" colspan="2" class="right_nav" height="3"></td>
			</tr>
		</table>
		<table border="0" width="100%" id="table3" cellpadding="0" style="border-collapse: collapse">
			<tr>
				<td> </td>
			</tr>
		</table>
		<table border="0" width="563" id="table2" cellpadding="4" style="border:1px solid #D9D9D9; border-collapse: collapse; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px" cellspacing="2">
			<form action=saveliuyan.asp method=post name=form1 onsubmit="return checksubmit();"><tr>
				<td width="563" valign="top" bgcolor="#EEEEEE">
				<img border="0" src="images/guestbook_question.gif" width="16" height="11">
				<font color="#FF6600">请在此发表您的留言 ( </font><font color="#ff0000">
				注:</font><font color="#666666">您的留言将随管理员的回复一起发布!</font><font color="#FF6600">)</font></td>
			</tr>
			<tr>
				<td width="563" valign="top">
				称呼<font color="#FF0000">(*)</font>:&nbsp; 
				<input type="text" name="username" size="11" value="<%if session("chk_name")<>"" then response.write session("chk_name") else response.write "匿名"%>">  
				Email:<input type="text" name="useremail" size="15"> 联系电话:<input type="text" name="userphone" size="15"></td>
			</tr>
			<tr>
				<td width="563" valign="top">
				内容<font color="#FF0000">(*)</font>:&nbsp; 
				<textarea rows="6" name="usercontent" cols="63"></textarea><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#FF0000">
				留言内容255个字以内,超过部分自动截除。严禁广告、反动违法言论!</font></td>
			</tr>
			<tr>
				<td width="563" valign="top">
				验证码<font color="#FF0000">(*)</font>:<input type="text" name="safecode" size="8" maxlength="6"><img src=comm/checkcode.asp border=0 align="absmiddle"> 
				&lt;-照着输入</td>
			</tr>
			<tr>
				<td width="563" valign="top">
				<p align="center"><input type="submit" value="递交留言" name="B1"></td>
			</tr></form>
			</table>
		<table border="0" width="100%" id="table4" height="30" cellpadding="0" style="border-collapse: collapse">
			<tr>
				<td><font color="#FF6600">
				<img border="0" src="images/U-010.gif" width="21" height="19" align="absmiddle">留言显示:</font></td>
			</tr><form action=guestBook.asp method=post>
			<tr>
				<td height="20" align=center>留言搜索:<select size="1" name="flag">
				<option value="1">按称呼查询</option>
				<option value="2">按电话号码查询</option>
				<option value="3">按电子邮件查询</option>
				<option value="4">按留言内容查询</option>
				</select><input type="text" name="keyword" size="20" maxlength="20"><input type="submit" value="搜索" name="B2"></td>
			</tr></form>
		</table>
		<table border="0" width="100%" id="table5" cellpadding="4" style="border-collapse: collapse; border: 1px solid #C0C0C0; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
			<%
dim sql,rs,arrlists(7),p,ii
select case flag
case 1
sql="select username,useremail,userphone,usercontent,useraddtime,userip,replycontent,replyaddtime from messagecontent where ishf=1 and username like '%"&keyword&"%' order by useraddtime desc"
case 2
sql="select username,useremail,userphone,usercontent,useraddtime,userip,replycontent,replyaddtime from messagecontent where ishf=1 and userphone like '%"&keyword&"%' order by useraddtime desc"
case 3
sql="select username,useremail,userphone,usercontent,useraddtime,userip,replycontent,replyaddtime from messagecontent where ishf=1 and useremail like '%"&keyword&"%' order by useraddtime desc"
case 4
sql="select username,useremail,userphone,usercontent,useraddtime,userip,replycontent,replyaddtime from messagecontent where ishf=1 and usercontent like '%"&keyword&"%' order by useraddtime desc"
case else
sql="select username,useremail,userphone,usercontent,useraddtime,userip,replycontent,replyaddtime from messagecontent where ishf=1 order by useraddtime desc"
end select
set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,1,1
	if (rs.eof and rs.bof) then
	response.write "<tr>"
    response.write "<td class=12px width=760 colspan=6><font color=#FF0000>暂时还没有任何数据</font></td>"
    response.write "</tr>"
    else
    rs.PageSize =12 '每页记录条数
			iCount=rs.RecordCount '记录总数
			iPageSize=rs.PageSize
    		maxpage=rs.PageCount 
    		page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if

end if
						  ii=1
						  while not rs.eof and ii<=rs.pagesize
for p=0 to 7
arrlists(p)=rs(p)
next

%>
<tr>
				<td bgcolor="#D9D9D9" width="97%">
				<p align="left"><%=arrlists(0)%><font color="#666666"> 
				于 </font><%=arrlists(4)%> 留言如下</td>
			</tr>
			<tr>
				<td style="line-height: 150%"><font color="#808080">留言内容:</font><%=Outleach(arrlists(3))%>
				</td>
			</tr>
			<%
			if arrlists(6)<>"" then%>
			<tr>
				<td style="line-height: 150%"><font color="#FF0000">店长回复</font><font color="#666666">(回复时间:<%=arrlists(7)%>):<br>
				</font><%=Outleach(arrlists(6))%></td>
			</tr>
			<%
end if
rs.movenext
ii=ii+1
wend
%>
		</table>
		<table border="0" width="100%" id="table7" cellpadding="0" style="border-collapse: collapse">
			<tr>
				<td><%call PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>")%></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</div>
<!--begin end-->
<%call boot()%><!--end end-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -