当前位置导航:炫浪网>>网络学院>>网页制作>>ASP教程

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

  <%
  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>

 
相关内容
赞助商链接