网络寻呼机数据库版处理发送消息SubmitMessage.asp

1   
2word=request("word")   
3toname=request("userid")   
4name=session("username")   
5  
6'检验输入的字节是否大于200   
7  
8if len(trim(word))>200 then   
9response.write("你输入的字节大于200,请

<a href="javascript:history.back()">返回</a>

1")   
2response.end   
3end if   
4  
5'不能给自己发信息   
6if name=toname then   
7response.write("不能给自己发信息,请

<a href="javascript:history.back()">返回</a>

 1")   
 2response.end   
 3end if   
 4  
 5set conn=server.createobject("adodb.connection")   
 6Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"   
 7DBPath = "Data Source=" & Server.MapPath( "webuser.mdb" )   
 8  
 9conn.Open Provider & DBPath   
10  
11  
12  
13'检验输入的字节是否和上次一样   
14  
15  
16sql="select top 1 word,adddate from talks where fromname='"& name & "' and toname='"& toname &"'order by adddate desc"   
17set rs=conn.execute(sql)   
18  
19if not rs.eof then   
20  
21myword=rs("word")   
22  
23if word=myword then   
24  
25response.write("发送的信息不能和上一次一样,请

<a href="javascript:history.back()">返回</a>

 1")   
 2rs.close   
 3set rs=nothing   
 4response.end   
 5end if   
 6end if   
 7  
 8set Rs=server.createobject("adodb.recordset")   
 9sql1="select * from talks"   
10rs.open sql1,conn,3,2   
11rs.addnew   
12rs("fromname")=name   
13rs("toname")=toname   
14rs("word")=word   
15rs.update   
16  
17  
18  
 1<html>
 2<head>
 3<meta content="Microsoft FrontPage 5.0" name="GENERATOR"/>
 4<meta content="FrontPage.Editor.Document" name="ProgId"/>
 5<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 6<title>保存信息</title>
 7<script language="javascript">   
 8function close_win(){   
 9window.close();   
10}   
11function autoclose(){   
12window.setTimeout("close_win()",0);}   
13autoclose();   
14</script>
15</head>
16<body>
17</body>
18</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus