📄 guest.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%
action=request.QueryString("action")
if action="save" then
user=request("user")
content=request("content")
if user<>"" or content<>"" then
sql="insert into guest(guest_user,guest_content,guest_time) values('"&user&"','"&gotTopic(content,300)&"','"&now()&"')"
conn.execute(sql)
response.write "<script LANGUAGE='javascript'>alert('留言成功!');</script>"
end if
end if
if action="del" then
gid=request("gid")
sql="delete from [guest] where guest_id="&gid&""
conn.execute(sql)
end if
%>
<html>
<head>
<link href=css.css rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<div align="center">
<table width="700" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="40" height="23"> </td>
<td width="582"> </td>
<td width="78"> </td>
</tr>
<tr>
<td height="329"> </td>
<td valign="top"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#66CCFF">
<!--DWLayoutTable-->
<tr>
<td height="24" colspan="2" valign="middle" bgcolor="#00FFFF"> <div align="center"><strong>网站留言板
</strong>--<a href="#guest">我要留言</a></div></td>
</tr>
<%
page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)
set rs=server.createobject("adodb.recordset")
sql="select * from [guest] order by guest_time desc"
rs.open sql,conn,1,1
if rs.eof then
%>
<TR>
<td >暂无网友留言!</td>
</TR>
<%else
rs.pagesize=8
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize
i=0
dim guest_id(),guest_user(),guest_content(),guest_reply(),guest_time()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve guest_id(i),guest_user(i),guest_content(i),guest_reply(i),guest_time(i)
guest_id(i)=rs("guest_id")
guest_user(i)=rs("guest_user")
guest_content(i)=rs("guest_content")
guest_reply(i)=rs("guest_reply")
guest_time(i)=rs("guest_time")
rs.movenext
loop
rs.close
for i=1 to ubound(guest_id)
%>
<tr>
<td height="115" colspan="2" valign="top" bgcolor="#FFFFFF"> <p align="left"><strong>第 <font color="#FF0000"><%=i%></font> 条留言内容:</strong></p>
<p align="left"><%=guest_content(i)%></p>
<p align="left">管理员回复:<font color="#ff0000"><%=guest_reply(i)%></font></p>
<p align="left"></p></td>
</tr>
<tr>
<td width="280" height="19" valign="top" bgcolor="#FFFFFF">留言人:<%=guest_user(i)%></td>
<td width="295" valign="top" bgcolor="#FFFFFF">留言时间:<%=guest_time(i)%> <%if session("admin_name")<>"" then%>
<a href="guest.asp?action=del&gid=<%=guest_id(i)%>">删除</a> | <a href=# onclick=window.open("g_reply.asp?g_id=<%=guest_id(i)%>","","height=300,width=400,resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");>回复</a> <%end if%></td>
</tr>
<%next
end if%>
<tr valign="middle" bgcolor="#00FFFF">
<td height="20" colspan="2">
<div align="right">第 <%=page%> 页 共 <%=totalpage%>
页 <%if page>1 then%><a href="guest.asp?page=<%=page-1%>">上一页</a><%end if%> <%if page<totalpage then%><a href="guest.asp?page=<%=page+1%>">下一页</a><%end if%></div></td>
</tr>
<tr>
<td height="120" colspan="2" valign="top" bgcolor="#FFFFFF"><form name="form1" method="post" action="guest.asp?action=save">
<table width="100%" height="131" border="0">
<tr>
<td width="13%" height="21"><a name="guest"></a></td>
<td width="13%">留言人:</td>
<td width="48%"><input name="user" type="text" maxlength="20"></td>
<td width="26%">*必填哦</td>
</tr>
<tr>
<td height="63"> </td>
<td>留言内容:</td>
<td><textarea name="content" cols="40" rows="8"></textarea></td>
<td>*最多300字,多余将被系统截去</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="提交留言" onClick="return check()"></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td height="24" colspan="2" valign="middle" bgcolor="#00FFFF"> <div align="center">版权所有:中国人民大学二手交易网</div></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="29"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</body>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
if(checkspace(document.form1.user.value)) {
document.form1.user.focus();
alert("留言人不能为空,请重新输入!");
return false;
}
if(checkspace(document.form1.content.value)) {
document.form1.content.focus();
alert("留言内容不能为空,请重新输入!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -