<%response.buffer=true%>
<!--#include file="conn.asp"-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=bbsinfo("bbsname")%></title>
<LINK 
href="css.css" type=text/css rel=stylesheet>
</head>
<body>
<!--#include file="top.asp"-->
<!--#include file="ubb.asp"-->
<%    
username=Request.Cookies("esung")("username")
password=Request.Cookies("esung")("password")
if username="" or password="" then
response.redirect"login.asp"
end if
   tname=request.querystring("username") 
    set rs1=conn.execute("SELECT  * FROM sms where tname='"&username&"' order by id desc")    
%> 
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="8" background="images/left.gif">&nbsp;</td>
    <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr> 
          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height=6></td>
              </tr>
            </table>
            <table width="754" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width=6 height=6><img src="images/index_2.gif" width="6" height="6"></td>
                      <td width="742" background="images/index_3.gif"></td>
                      <td width=6> <div align="right"><img src="images/index_1.gif" width="6" height="6"></div></td>
                    </tr>
                  </table>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td width=1 bgcolor="C6C3C4"></td>
                      <td height=6 bgcolor="FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="8">
                          <tr>
                            <td>
                              <p align="center"><a href="mysms.asp?menu=write">发送新信息</a></p>
                            </td>                                                    
                          </tr>                                                   
                        </table></td>                                                                               
                      <td width=1 bgcolor="C6C3C4"></td>                                                                               
                    </tr>                                                                               
                  </table>                                                                               
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">                                                                               
                    <tr>                                                                                
                      <td width=5 height=5><img src="images/left_data_4.gif" width="5" height="5"></td>                                                                               
                      <td width="742" background="images/left_data_6.gif"></td>                                                                               
                      <td width=5> <div align="right"><img src="images/left_data_5.gif" width="5" height="5"></div></td>                                                                               
                    </tr>                                                                               
                  </table></td>                                                                               
              </tr>                                                                               
            </table>                                                                               
            <br>                                                                                 
            <table width="755" border="0" cellpadding="3" cellspacing="1" bgcolor="494949" class="listcontents3">                                                                                
             <% menu=request.querystring("menu")
select case menu
case ""
%><tr>                                                                                 
                <td width="188" bgcolor="#C6C3C4"> 
                  <p align="center"><font color="#FFFFFF">发信人</font></p>
                </td>                                                                                
                <td width="188" bgcolor="#C6C3C4"> 
                  <p align="center"><font color="#FFFFFF">内容</font></td>                                                                                
                <td width="188" bgcolor="#C6C3C4"> 
                  <p align="center"><font color="#FFFFFF">发送时间</font></td>                                                                                
                <td width="189" bgcolor="#C6C3C4"> 
                  <p align="center"><font color="#FFFFFF">删除</font></td>                                                                                
              </tr>                                                                             
                                                                 
                                                                 
                 <% do while not rs1.eof %>                                                                  
              <tr bgcolor="F3F3F3">                                                                 
                                                              
                <td width="188"> 
                  <p align="center"><a title='点击给<%=rs1("name")%>回复短信' href=mysms.asp?menu=write&username=<%=rs1("name")%>><%=rs1("name")%></p>
                </td>                                                                                
                                                              
                <td width="188"> 
                  <p align="center"> <%=code_jk(rs1("neirong"))%>  　</p>
                </td>                                                                                
                                                              
                <td width="188"> 
                  <p align="center"><%=rs1("riqi")%></p>
                </td>                                                                                
                                                              
                <td width="189"> 
                  <p align="center"><a href="mysms.asp?menu=del&id=<%=rs1("id")%>">删除</a>   </p>
                </td>                                                                                
              </tr>                                                                           
                                                                 
               <%       
rs1.movenext                        
loop        
conn.execute("update sms set isnew='1' where tname='"&username&"'")   

case "write"%>
                                                   
     <form method="POST" action="?menu=save">                                                                         
              <tr bgcolor="F3F3F3">                                                                 
                                                              
                <td width="181"> 
                  <p align="center">接受人</td>                                                                                
                                                              
                <td width="556" colspan="3">                   
<input type="text" name="tname" size="55" value="<%=tname%>"></td>                                                                                
                                                              
              </tr>                                                                           
                                                                              
              <tr bgcolor="F3F3F3">                                                                 
                                                              
                <td width="181"> 
                  <p align="center">内容：（支持ubb)</td>                                                                                
                                                              
                <td width="556" colspan="3"> <textarea rows="8" name="neirong" cols="77"></textarea>
                  <p align="center"><input type="submit" value=" 发 送 " name="B1"> <input type="reset" value=" 重 置 " name="B2"></p>
                </td>   </form>   
                
<%case"save"            
tname=Replace(Request.Form("tname"),"'","''")            
neirong=Replace(Request.Form("neirong"),"'","''")            
if tname="" or neirong="" then            
response.write"<script language='javascript'>alert('请填写完整信息！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
else   
set isha=conn.execute("select username from member where username='"&tname&"'")   
if isha.eof then   
response.write"<script language='javascript'>alert('该用户不存在！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
else                  
conn.execute("insert into sms(name,neirong,riqi,tname)values('"&username&"','"&neirong&"',now,'"&tname&"')")
response.write"<script language='javascript'>alert('给"&tname&"的信息发送成功！')</script>"   
response.write"<script language='javascript'>window.location='Mysms.asp'</script>"
end if                  
end if  
case"del"
id=request.querystring("id")
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM sms where id="&id 
rs.Open sql,conn,3,2
rs.Delete
rs.Close
set rs=nothing
response.redirect "mysms.asp"  
end select%>                                                                         
                                                               
              </tr>                                                                           
            </table>                                                                               
 <table width="754" border="0" align="center" cellpadding="0" cellspacing="0">                                                                               
              <tr>                                                                                
                <td>                                                                               
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">                                                                               
                    <tr>                                                                                
                      <td width=5 height=5><img src="images/left_data_4.gif" width="5" height="5"></td>                                                                               
                      <td width="742" background="images/left_data_6.gif"></td>                                                                               
                      <td width=5> <div align="right"><img src="images/left_data_5.gif" width="5" height="5"></div></td>                                                                               
                    </tr>                                                                               
                  </table></td>                                                                               
              </tr>                                                                               
            </table></td>                                                                               
        </tr>                                                                               
      </table>                                                                                
      <!--#include file="down.asp"-->                                                                               
    </td>                                                                               
    <td width="8" background="images/right.gif">&nbsp;</td>                                                                               
  </tr>                                                                               
</table>                                                                               
</body>                                                                               
</html>                                                                               
