网络寻呼机数据库版处理发送消息SubmitMessage.asp
程序员文章站
2022-03-25 07:57:20
<% word=request("word") toname=request("userid") ...
<%
word=request("word")
toname=request("userid")
name=session("username")
检验输入的字节是否大于200
if len(trim(word))>200 then
response.write("你输入的字节大于200,请<a href=javascript:history.back()>返回</a>")
response.end
end if
不能给自己发信息
if name=toname then
response.write("不能给自己发信息,请<a href=javascript:history.back()>返回</a>")
response.end
end if
set conn=server.createobject("adodb.connection")
provider = "provider=microsoft.jet.oledb.4.0;"
dbpath = "data source=" & server.mappath( "webuser.mdb" )
conn.open provider & dbpath
检验输入的字节是否和上次一样
sql="select top 1 word,adddate from talks where fromname="& name & " and toname="& toname &"order by adddate desc"
set rs=conn.execute(sql)
if not rs.eof then
myword=rs("word")
if word=myword then
response.write("发送的信息不能和上一次一样,请<a href=javascript:history.back()>返回</a>")
rs.close
set rs=nothing
response.end
end if
end if
set rs=server.createobject("adodb.recordset")
sql1="select * from talks"
rs.open sql1,conn,3,2
rs.addnew
rs("fromname")=name
rs("toname")=toname
rs("word")=word
rs.update
%>
<html>
<head>
<meta name="generator" content="microsoft frontpage 5.0">
<meta name="progid" content="frontpage.editor.document">
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>保存信息</title>
<script language=javascript>
function close_win(){
window.close();
}
function autoclose(){
window.settimeout("close_win()",0);}
autoclose();
</script>
</head>
<body>
</body>
</html>
word=request("word")
toname=request("userid")
name=session("username")
检验输入的字节是否大于200
if len(trim(word))>200 then
response.write("你输入的字节大于200,请<a href=javascript:history.back()>返回</a>")
response.end
end if
不能给自己发信息
if name=toname then
response.write("不能给自己发信息,请<a href=javascript:history.back()>返回</a>")
response.end
end if
set conn=server.createobject("adodb.connection")
provider = "provider=microsoft.jet.oledb.4.0;"
dbpath = "data source=" & server.mappath( "webuser.mdb" )
conn.open provider & dbpath
检验输入的字节是否和上次一样
sql="select top 1 word,adddate from talks where fromname="& name & " and toname="& toname &"order by adddate desc"
set rs=conn.execute(sql)
if not rs.eof then
myword=rs("word")
if word=myword then
response.write("发送的信息不能和上一次一样,请<a href=javascript:history.back()>返回</a>")
rs.close
set rs=nothing
response.end
end if
end if
set rs=server.createobject("adodb.recordset")
sql1="select * from talks"
rs.open sql1,conn,3,2
rs.addnew
rs("fromname")=name
rs("toname")=toname
rs("word")=word
rs.update
%>
<html>
<head>
<meta name="generator" content="microsoft frontpage 5.0">
<meta name="progid" content="frontpage.editor.document">
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>保存信息</title>
<script language=javascript>
function close_win(){
window.close();
}
function autoclose(){
window.settimeout("close_win()",0);}
autoclose();
</script>
</head>
<body>
</body>
</html>