<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<% '=========================================================
' File: Usersms.asp
' Version:3.0
' Date: 2005-11-6
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
Response.Buffer = true
dim tablebody
dim boxName,smscount,smstype,readaction,turl
dim Usersmsr
if not founduser then
  	errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
	founderr=true
end if

stats="用户短信服务"
call nav()
if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var(membername & "的帐号","mycount.asp")
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<tr>
<th width=12% height=25 id=tabletitlelink><a href=mycount.asp>我的帐号</a></th>
<th width=11%  id=tabletitlelink><a href=mymodify.asp>基本资料</a></th>
<th width=11%  id=tabletitlelink><a href=modifypsw.asp>密码修改</a></th>
<th width=11%  id=tabletitlelink><a href=modifyfd.asp>交友资料</a></th>
<th width=11%  id=tabletitlelink><a href=modifyadd.asp>联系资料</a></th>
<th width=11%  id=tabletitlelink><a href=usersms.asp>短信服务</a></th>
<th width=11%  id=tabletitlelink><a href=friendlist.asp>我的好友</a></th>
<th width=11%  id=tabletitlelink><a href=favlist.asp>我的收藏</a></th>
<th width=11%  id=tabletitlelink><a href=userphoto.asp>我的相册</a></th>
</tr>
</table>
<%
call main()
end if
call activeonline()
call footer()

sub main()
smscount=0
Set Rs=conn.Execute("Select Count(id) From Ms_Message Where incept='"&trim(membername)&"'")
SmsCount=Rs(0)
If SmsCount>Cint(GroupSetting(133)) Then'自动清除短信
	i=SmsCount-Cint(GroupSetting(133))
	Set Rs=conn.Execute("Select top "&i&" id From Ms_Message Where incept='"&trim(membername)&"' Order by id,delR Desc")
	While not rs.eof
		conn.Execute("Delete From Ms_Message Where id="&rs(0))
		rs.movenext
	Wend
	SmsCount=i
End if
Rs.close:Set Rs=Nothing
call tumppages()
strFileName="usersms.asp?action="&request("action")&""
select case request("action")
case "inbox"
	boxName="收件箱"
	smstype="inbox"
	readaction="read"
	turl="readsms"
	sql="select * from Ms_message where incept='"&trim(membername)&"' and issend=1 and delR=0 order by flag,sendtime desc"
	call smsbox()
case "outbox"
	boxName="草稿箱"
	smstype="outbox"
	readaction="edit"
	turl="sms"
	sql="select * from Ms_message where sender='"&trim(membername)&"' and issend=0 and delS=0 order by sendtime desc"
	call smsbox()
case "issend"
	boxName="已发送的消息"
	smstype="issend"
	readaction="outread"
	turl="readsms"
	sql="select * from Ms_message where sender='"&trim(membername)&"' and issend=1 and delS=0 order by sendtime desc"
	call smsbox()
case "recycle"
	boxName="垃圾箱"
	smstype="recycle"
	readaction="read"
	turl="readsms"
	sql="select * from Ms_message where ((sender='"&trim(membername)&"' and delS=1) or (incept='"&trim(membername)&"' and delR=1)) and not delS=2 order by sendtime desc"
	call smsbox()
case else
	boxName="收件箱"
	smstype="inbox"
	readaction="read"
	turl="readsms"
	sql="select * from Ms_message where incept='"&trim(membername)&"' and issend=1 and delR=0 order by flag,sendtime desc"
	call smsbox()
end select
end sub

sub smsbox()
dim newstyle
response.write "<TABLE cellpadding=6 cellspacing=1 align=center class=tableborder1><TBODY>"&_
				"<TR>"&_
				"<TD align=center class=tablebody1><a href=usersms.asp?action=inbox><img src=images/m_inbox.gif border=0 alt=收件箱></a> &nbsp; <a href=usersms.asp?action=outbox><img src=images/M_outbox.gif border=0 alt=发件箱></a> &nbsp; <a href=usersms.asp?action=issend><img src=images/M_issend.gif border=0 alt=已发送邮件></a>&nbsp; <a href=usersms.asp?action=recycle><img src=images/M_recycle.gif border=0 alt=废件箱></a>&nbsp; <a href=friendlist.asp><img src=images/M_address.gif border=0 alt=地址簿></a>&nbsp;<a href=JavaScript:openScript('messanger.asp?action=new',500,400)><img src=images/m_write.gif border=0 alt=发送消息></a>"&_
                           "</td></tr></TBODY></TABLE>"%>
<br>
<table cellpadding=3 cellspacing=0 align=center class=tableborder1>
  <tr>
    <td class=tablebody1 width=130>邮箱容量（<font color="#FF0000"><%=GroupSetting(133)%></font>）封：</td>
	<%dim Persms,Barwidth
	Persms=Round((SmsCount/Cint(GroupSetting(133)))*100)
	if Persms=0 then
	Barwidth=0
	else
	Barwidth=Persms+3
	end if%>
    <td Width="*" class=tablebody2><img src="Skins/default/bar/bar.gif" width=<%=Barwidth%> height="16" align=absmiddle title=邮箱容量(<%=GroupSetting(133)%>),已使用(<%=SmsCount%>)></td>
    <td width=120 class=tablebody1>已使用：<font color=red><%=Persms%></font> ％</td>
  </tr>
</table>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<form action="messanger.asp" method=post name=inbox>
<tr>
<th valign=middle width=30 height=25>已读</th>
<th valign=middle width=100>
<%if smstype="inbox" or smstype="recycle" then response.write "发件人" else response.write "收件人"%>
</th>
<th valign=middle width=300>主题</th>
<th valign=middle width=150>日期</th>
<th valign=middle width=50>大小</th>
<th valign=middle width=30>操作</th>
</tr>
<%
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
%>
<tr>
<td class=tablebody1 align=center valign=middle colspan=6>您的<%=boxname%>中没有任何内容。</td>
</tr>
<%else
call rspages()
do while not rs.eof
if rs("flag")=0 then
tablebody="tablebody2"
newstyle="font-weight:bold"
else
tablebody="tablebody1"
newstyle="font-weight:normal"
end if
%>
<tr>
<td class=<%=tablebody%> align=center valign=middle>
<%
select case smstype
case "inbox"
	if rs("flag")=0 then
	response.write "<img src=""images/m_news.gif"">"
	else
	response.write "<img src=""images/m_olds.gif"">"
	end if
case "outbox"
	response.write "<img src=""images/m_issend_2.gif"">"
case "issend"
	response.write "<img src=""images/m_issend_1.gif"">"
case "recycle"
	if rs("flag")=0 then
	response.write "<img src=""images/m_news.gif"">"
	else
	response.write "<img src=""images/m_olds.gif"">"
	end if
end select
%>
</td>
<td class=<%=tablebody%> align=center valign=middle style="<%=newstyle%>">
<%if smstype="inbox" or smstype="recycle" then%>
<a href="dispuser.asp?name=<%=ihtmlencode(rs("sender"))%>" target=_blank><%=ihtmlencode(rs("sender"))%></a>
<%else%>
<a href="dispuser.asp?name=<%=ihtmlencode(rs("incept"))%>" target=_blank><%=ihtmlencode(rs("incept"))%></a>
<%end if%>
</td>
<td class=<%=tablebody%> align=left style="<%=newstyle%>"><a href="JavaScript:openScript('messanger.asp?action=<%=readaction%>&id=<%=rs("id")%>&sender=<%=rs("sender")%>',500,400)"><%=ihtmlencode(rs("title"))%></a>	</td>
<td class=<%=tablebody%> style="<%=newstyle%>"><%=rs("sendtime")%></td>
<td class=<%=tablebody%> style="<%=newstyle%>"><%=len(rs("content"))%>Byte</td>
<td align=center valign=middle width=30 class=<%=tablebody%>><input type=checkbox name=id value=<%=rs("id")%>></td>
</tr>
<%
	rs.movenext
	loop
	end if
	rs.close
	set rs=nothing
%>
<tr><td align=left valign=middle colspan=6 class=tablebody2><%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td></tr>
<tr> 
<td align=right valign=middle colspan=6 class=tablebody2>节省每一分空间，请及时删除无用信息&nbsp;<input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">选中所有显示记录&nbsp;<input class=2 type=submit name=action onclick="{if(confirm('确定删除选定的纪录吗?')){this.document.inbox.submit();return true;}return false;}" value="删除<%=replace(boxname,"箱","")%>">&nbsp;<input class=2 type=submit name=action onclick="{if(confirm('确定清除<%=boxname%>所有的纪录吗?')){this.document.inbox.submit();return true;}return false;}" value="清空<%=boxname%>"></td>
</tr>
</form>
<tr> 
<td align=left valign=middle colspan=6 class=tablebody1><font color=red>注意：</font><br>&nbsp;&nbsp;您的邮箱容量 <b><font color=red><%=Cint(GroupSetting(133))%></font></b>
封，请及时清理，一但邮箱容量占用100%系统将会自动清除超过邮件数！<br>
	  <li>删除短信系统赠送金钱/篇 <b><%=GroupSetting(136)%> <%=GroupSetting(137)%></b>*邮件数（清理废件箱才有赠送） 元</li>
		<li>删除短信系统赠送魅力/篇 <b><%=GroupSetting(138)%> <%=GroupSetting(139)%></b>*邮件数（清理废件箱才有赠送） 点</li>
		<li>删除短信系统赠送经验/篇 <b><%=GroupSetting(140)%> <%=GroupSetting(141)%></b>*邮件数（清理废件箱才有赠送） 点</li></td>
  </tr>
</table>
<%
end sub
%>