<!--#include file="conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="../webconfig.asp"-->
<!--#include file="../fuction.asp"-->

<!--#include file="../webtop.asp"-->

<table width="1000" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="6" colspan="3"></td>
  </tr>
  <tr>
    <td width="20"></td>
    <td valign="bottom"><img src="<%=weburl%>images/arrow01.gif" width="11" height="11" /> Your present position: <a href="<%=weburl%>"><%=webname%></a> -><span class="table-shangxia"><span class="b14"> <a href="mysms.asp?menu=write">my message </a></span></span></td>
    <td valign="bottom"></td>
  </tr>
  <tr>
    <td height="6" colspan="3"></td>
  </tr>
</table>
<%    
username=nosql(session("username"))
password=nosql(session("userpassword"))
if username="" or password="" then
response.redirect"login.asp"
end if
   tname=nosql(request.querystring("username"))
    set rs1=conn.execute("SELECT  * FROM sms where tname='"&username&"' order by id desc")    
%> <br><br>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
  <tr>
    <td>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top">
            <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999" class="listcontents3">
              <% menu=request.querystring("menu")
select case menu
case ""
%>
              <tr bgcolor="CCCCCC">
                <td width="188" height="23">
                <p align="center" class="style1">From</p></td>
                <td width="556">
                <p align="center" class="style1">Title</td>
                <td width="188">
                <p align="center" class="style1">Time</td>
                <td width="189">
                <p align="center" class="style1">Del</td>
              </tr>
              <% do while not rs1.eof %>
              <tr bgcolor="#FFFFFF">
                <td width="188">
                  <p align="center"><a title='Reply to:<%=rs1("name")%>' href=mysms.asp?menu=write&username=<%=rs1("name")%>><%=rs1("name")%></a></p></td>
                <td width="556">
                  <p align="center"><a title='Check:<%=rs1("title")%>' href=mysms.asp?menu=action&id=<%=rs1("id")%>><%=HTMLEncode(rs1("title"))%></a>
				  [<%if rs1("isnew")=1 then%>
				  <span style="color: #FF0000">Not Read </span>
				  <%else%>
				  Allready Read
				  <%end if%>]</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")%>">Del</a> </p></td>
              </tr>
              <%       
rs1.movenext                        
loop        
'conn.execute("update sms set isnew='1' where tname='"&username&"'") 
case "action"
id=nosql(int(Request.querystring("id")))
    set rs2=conn.execute("SELECT  * FROM sms where tname='"&username&"' and id="&id&"")    
	if rs2.Eof or rs2.Bof then
response.write"<SCRIPT language=JavaScript>alert('Canceled£¡');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end 
 else      
 
%>             <tr bgcolor="CCCCCC">
                <td height="23" colspan="4">                <p class="style1">&nbsp;&nbsp;Reading£º<%=HTMLEncode(rs2("title"))%>&nbsp;<a href="javascript:history.go(-1)">Back</a></p>                  </td>
                </tr> <tr bgcolor="#FFFFFF">
                <td colspan="4">
                  <p>&nbsp;&nbsp;From£º<a title='Reply to:<%=rs2("name")%>' href=mysms.asp?menu=write&username=<%=rs2("name")%>><%=rs2("name")%></a>  ¡¡Title£º<%=HTMLEncode(rs2("title"))%> ¡¡Time£º<%=rs2("riqi")%> ¡¡<a href="mysms.asp?menu=del&id=<%=rs2("id")%>" style="color: #FF0000">Del</a> <a href=mysms.asp?menu=write&username=<%=rs2("name")%>><span class="line1" style="color: #FF0000">Reply</span></a></p>                  </td>
                </tr>
              <tr bgcolor="#FFFFFF">
                <td colspan="4">&nbsp;&nbsp;Contet£º<%=HTMLEncode(rs2("neirong"))%></td>
              </tr>
  
<%
conn.execute("update sms set isnew='0' where id="&rs2("id")) 
end if
case "write"%>
              <form method="POST" action="?menu=save">
                <tr bgcolor="#FFFFFF">
                  <td width="188" align="center">
                   To£º</td>
                  <td width="556" colspan="3">
                    <input type="text" name="tname" size="55" value="<%=tname%>" class=wenbenkuang></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="188" align="center">Title£º</td>
                  <td width="556" colspan="3"><input name="title" type="text" class=wenbenkuang id="title" size="55"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="188" align="center" valign="top">
                   Content£º</td>
                  <td width="556" colspan="3">
                    <textarea rows="10" name="neirong" cols="77" class=wenbenkuang></textarea></td>
                <tr bgcolor="#FFFFFF">
                  <td colspan="4" align="center"><input type="submit" value="Send" name="B1" class="go-wenbenkuang">¡¡
                  <input type="reset" value="Reset" name="B2" class="go-wenbenkuang"></td>
              </form>
              <%case"save"            
tname=nosql(Replace(Request.Form("tname"),"'","''")) 
title=nosql(Replace(Request.Form("title"),"'","''"))         
neirong=nosql(Replace(Request.Form("neirong"),"'","''"))            
if tname="" or neirong="" then            
response.write"<script language='javascript'>alert('Please Check the title or content£¡')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
else   
set isha=conn.execute("select username from shop_user where username='"&tname&"'")   
if isha.eof then   
response.write"<script language='javascript'>alert('No£¡')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
else    
rq=now()  
isnew=1            
conn.execute("insert into sms([name],title,neirong,riqi,tname,isnew)values('"&username&"','"&title&"','"&neirong&"','"&rq&"','"&tname&"','"&isnew&"')")
response.write"<script language='javascript'>alert('This Message Send to him/her£¡')</script>"   
response.write"<script language='javascript'>window.location='index.asp'</script>"
end if                  
end if  
case"del"
id=int(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%>
            </table>
          <p>&nbsp;</p></td>
        </tr>
    </table></td>
  </tr>
</table>
            </td>                                                                               
        </tr>                                                                               
      </table>                                                                                
                                                                                     
    </td>                                                                               
  </tr>                                                                               
</table>                                                                               
<!--#include file="../copyright.asp"-->             