网络寻呼机数据库版显示消息showmessage.asp

网络整理 - 07-26
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>显示自己的信息</title>
<script language=javascript>
<!--
function checks(theform1){    
if (theform1.word.value=="")
{
   alert("请随便说几句。");
   theform1.word.focus();
   return false;
   }
   
  return true; }
  
//-->
</script>

</head>

<body>
<br><br>
<%
  
   username=session("username")
Set conn=server.createobject("adodb.connection")
    Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
    DBPath = "Data Source=" & Server.MapPath( "webuser.mdb" )

    conn.Open Provider & DBPath
    
    set rs=server.createobject("adodb.recordset")
    
    sql="select id,fromname,toname,word,adddate,isread from talks where toname='"& username &"'and  isread=0 order by adddate"
    
    rs.open sql,conn,3,3
    rs.pagesize=1
    Page = CLng(Request("Page"))    
    If Page < 1 Then Page = 1  
    If Page > rs.PageCount Then Page = rs.PageCount
    
    %>

<form method="post" name=form action="SubmitMessage.asp">
  <table cellspacing="1" bordercolor="#111111">
    <tr>
      <td colspan="2"><b><font size="3">发送短消息</font></b></td>
    </tr>
   
    <tr>
      <td colspan="2">
      <table  width="540">
        <%  if rs.eof or rs.bof then %>
        <tr>
          <td><% response.write"目前没有你的消息" %></td>
        </tr>
        <% else %>
        <tr>
          <td><% show rs,page%></td>
        </tr>
        <tr>
          <td>
<%        
   Sub Show( rs, Page )       
       rs.AbsolutePage = Page
%>  

          <table cellspacing="0"  width="534" cellpadding="0">
            <%  For iPage = 1 To rs.PageSize %>
             <tr >
              <td colspan="2"><font color=red><%=rs("fromname")%></font>于<%=rs("adddate")%>传呼于你</td>
            </tr>
            <tr >
              <td colspan="2">
      <%
      word=replace(rs("word"),vbcrlf,"<br>")
      response.write word
      %>
              </td>
            </tr>
            <tr>
      <td>回复对象</td>
      <td>
        <input type="text" size="15" value=<%=rs("fromname")%> readonly>
      </td>
    </tr>
    <tr>
      <td valign="top">回复信息</td>
      <td>
        <textarea name=word cols=40 rows="5"></textarea>
      </td>
    </tr>
    <tr>
      <td> </td>
      <td>输入的汉字不要超过<font color="#FF0000">200</font>个汉字</td>
    </tr>
       <%
      sql="update talks set isread=-1 whereid")
      conn.execute(sql)
       rs.movenext    
       If rs.EOF Then Exit For    
       Next %>     

          </table>
          </td>
        </tr>
        <tr>
           <td>
              <% If Page <> rs.PageCount Then %>
              <a href= showmessage.asp?Page=<%=(Page+1)%>>下一条</a>
              <% End If %>
            </td>
            </tr>
      </table>
      <% end sub %>
      </td>
    </tr>
    
    <tr>
      <td colspan="2">
        <input type="submit" value="传呼">  <input type="reset" value="重写"> 
        <input type="button" value="关闭窗口" onClick=Javascript:window.close()>
      </td>
    </tr>
  </table>

</form>
  <%
    end if
  rs.close
  set rs=nothing
  conn.close
  set conn=nothing
  %>
</body>

</html>