<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<!--#include file=inc/ubbcode.asp-->
<html>
<head>
<title><%=webname%>--短消息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body topmargin="0" leftmargin="0" onkeydown="if(event.keyCode==13 && event.ctrlKey)messager.submit()">
<%
 '=========================================================
' File: messanger.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
'=========================================================
dim msg
dim abgcolor
dim username
if not founduser then
  	errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
	founderr=true
end if
if Cint(GroupSetting(124))=0 then
	Errmsg=Errmsg+"<br>"+"<li>您没有浏览发送短信的权限，请<a href=login.asp>登陆</a>或者同管理员联系。"
	founderr=true
end if
stats="短信管理"
if founderr then
	call Mslove_error()
else
	select case request("action")
	case "new"
		call sendmsg()
	case "read"
		call read()
	case "outread"
		call read()
	case "delet"
		call delete()
	case "newmsg"
		call newmsg()
	case "send"
		call savemsg()
	case "fw"
		call fw()
	case "edit"
		call edit()
	case "savedit"
		call savedit()
	case "删除收件"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call delinbox()
	case "清空收件箱"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call AllDelinbox()
	case "删除草稿"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call deloutbox()
	case "清空草稿箱"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call AllDeloutbox()
	case "删除已发送的消息"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call delissend()
	case "清空已发送的消息"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call AllDelissend()
	case "删除垃圾"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call delrecycle()
	case "清空垃圾箱"
		stats=request("action")
		call nav()
		call head_var(membername & "的帐号","mycount.asp")
		call AllDelrecycle()
	case else
	  	errmsg=errmsg+"<br>"+"<li>请指定正确的参数。"
		founderr=true
	end select
	if founderr then call Mslove_error()
end if
call activeonline()

'发送信息
sub sendmsg()
stats="发送短信"
dim sendtime,title,content
if Cint(GroupSetting(134))<>0 and dateadd("n",Cint(GroupSetting(134)),myjoinDate)>=Now() then
  	errmsg=errmsg+"<br>"+"<li>新注册用户"&GroupSetting(134)&"分钟后才能撰写日记，请稍后<a href=login.asp target=_blank>登录</a>。"
	founderr=true
	exit sub
end if
if request("id")<>"" and isNumeric(request("id")) then
if Cint(GroupSetting(142))=0 then
  	errmsg=errmsg+"<br>"+"<li>您没有回复短信权限，等级不够，请稍后<a href=login.asp target=_blank>登录</a>。"
	founderr=true
	exit sub
end if
set rs=server.createobject("adodb.recordset")
sql="select sendtime,title,content from Ms_message where incept='"&trim(membername)&"' and id="&request("id")
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
sendtime=rs("sendtime")
title="RE " & rs("title")
content=rs("content")
end if
rs.close
set rs=nothing
end if
%>
<form action="messanger.asp" method=post name=messager>
<input type=hidden name="action" value="send">
<table cellpadding=3 cellspacing=1 align=center class=tableborder1 Style="width:98%">
          <tr> 
            <th colspan=3>发送短消息（请输入完整信息）</td>
          </tr>
          <tr> 
            <td class=tablebody1 valign=middle><b>收件人：</b></td>
            <td class=tablebody1 valign=middle>
             <input type=text name="touser" value="<%=request("touser")%>" size=40>
              <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value)>
              <OPTION selected value="">选择</OPTION>
<%
set rs=server.createobject("adodb.recordset")
sql="select friend from Ms_Friend where username='"&trim(membername)&"' and Fsub=1 order by Addtime desc"
rs.open sql,conn,1,1
do while not rs.eof
%>
			  <OPTION value="<%=rs(0)%>"><%=rs(0)%></OPTION> 
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
			  </SELECT>
            </td>
          </tr>
          <tr> 
            <td class=tablebody1 valign=top width=15%><b>标题：</b></td>
            <td class=tablebody1 valign=middle>
              <input class=2 type=text name="title" size=40 maxlength=80 value="<%=title%>">
            </td>
          </tr>
		    <%if Cint(Codeshow(2))=1 then%>
      <TR> 
        <TD width=40% height="37" class=tablebody1><strong>验证码：</strong></TD>
        <TD  class=tablebody1> <input type="text" name="codestr" maxlength="4" size="4">&nbsp;<%=GetCode()%></TD>
      </TR>
      <%end if%>
          <tr> 
            <td class=tablebody1 valign=top width=15%><b>内容：</b></td>
            <td  class=tablebody1 valign=middle>
              <textarea cols=70 rows=6 name="message" title="Ctrl+Enter发送"><%if request("id")<>"" then%>
====== 在 <%=sendtime%> 您来信中写道： ======
<%=server.htmlencode(content)%>
=====================================
<%end if%></textarea>
            </td>
          </tr>
          <tr> 
            <td  class=tablebody1 colspan=2>
<b>说明</b>：
<li>您可以使用<b>Ctrl+Enter</b>键快捷发送短信</li>
<li>可以用英文状态下的逗号将用户名隔开实现群发，最多<b><%=GroupSetting(125)%></b>个用户</li>
<li> 标题最多<b>50</b>个字符，内容最多<b><%if GroupSetting(126)=0 then
response.Write("不限")
else
response.write(GroupSetting(126))
end if%></b>个字符</li>
        <li>发布短信操作金钱/篇 <b><%=GroupSetting(127)%> <%=GroupSetting(128)%></b> 元</li>
		<li>发布短信操作魅力/篇 <b><%=GroupSetting(129)%> <%=GroupSetting(130)%></b> 点</li>
		<li>发布短信操作经验/篇 <b><%=GroupSetting(131)%> <%=GroupSetting(132)%></b> 点</li>
            </td>
          </tr>
          <tr> 
            <td  class=tablebody2 valign=middle colspan=2 align=center> 
              <input class=2 type=Submit value="发送" name=Submit>
              &nbsp; 
              <input class=2 type=Submit value="保存" name=Submit>
              &nbsp; 
              <input class=2 type="reset" name="Clear" value="清除">
              &nbsp; 
<%if request("reaction")="chatlog" then%>
              <input class=2 type=button value="关闭聊天记录" name="chatlog" onclick="location.href='?action=new&id=<%=request("id")%>&touser=<%=request("touser")%>'">
<%else%>
              <input class=2 type=button value="查看聊天记录" name="chatlog" onclick="location.href='?action=new&id=<%=request("id")%>&touser=<%=request("touser")%>&reaction=chatlog'">
<%end if%>
              &nbsp; 
              <input class=2 type="button" name="close" value="关闭" onclick="window.close()">
            </td>
          </tr>
<%if request("reaction")="chatlog" then%>
          <tr> 
            <th colspan=3>我与<%=request("touser")%>的聊天记录</th>
          </tr>
<%if membername=request("touser") then%>
          <tr> 
            <td class=tablebody1 colspan=3>自己跟自己的聊天记录没什么好看的：）</td>
          </tr>
<%else%>
<%
	set rs=server.createobject("adodb.recordset")
	sql="select * from Ms_message where ((sender='"&trim(membername)&"' and incept='"&replace(request("touser"),"'","")&"') or (sender='"&replace(request("touser"),"'","")&"' and incept='"&trim(membername)&"')) and delS=0 order by sendtime desc"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
%>
          <tr> 
            <td class=tablebody1 colspan=3>还没有任何聊天记录！</td>
          </tr>
<%
	else
	do while not rs.eof
%>
                <tr>
                    <td class=tablebody2 height=25 colspan=3>
<%if rs("sender")=membername then%>
                    在<b><%=rs("sendtime")%></b>，您发送此消息给<b><%=htmlencode(rs("incept"))%></b>！
<%else%>
		    在<b><%=rs("sendtime")%></b>，<b><%=htmlencode(rs("sender"))%></b>给您发送的消息！
<%end if%></td>
                </tr>
                <tr>
                    <td  class=tablebody1 valign=top align=left colspan=3>
                    <b>消息标题：<%=htmlencode(rs("title"))%></b><hr size=1>
                    <%=UBBCode(rs("content"))%>
		    </td>
                </tr>
<%
	rs.movenext
	loop
	end if
	rs.close
	set rs=nothing
%>
<%end if%>
<%end if%>
        </table>
</form>
<%
end sub
'读取信息
sub read()
stats="阅读短信"
if request("id")="" or not isNumeric(request("id")) then
Errmsg=Errmsg+"<br>"+"<li>请指定相关参数。"
Founderr=true
exit sub
end if
	set rs=server.createobject("adodb.recordset")
	if request("action")="read" then
   	sql="update Ms_message set flag=1 where ID="&cstr(request("id"))
	conn.execute(sql)
	end if
	sql="select * from Ms_message where (incept='"&trim(membername)&"' or sender='"&trim(membername)&"') and id="&cstr(request("id"))
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		errmsg=errmsg+"<br>"+"<li>你是不是跑到别人的信箱啦、或者该信息已经收件人删除。"
		founderr=true
	end if
	if not founderr then
%>
<table cellpadding=3 cellspacing=1 align=center  class=tableborder1 Style="width:98%">
  <tr>
                <th colspan=3>欢迎使用短消息接收，<%=membername%></th>
            </tr>
            <tr>
                <td class=tablebody1 valign=middle align=center colspan=3><a href="messanger.asp?action=delet&id=<%=rs("id")%>"><img src="images/m_delete.gif" border=0 alt="删除消息"></a> &nbsp; <a href="messanger.asp?action=new"><img src="images/m_write.gif" border=0 alt="发送消息"></a> &nbsp;<a href="messanger.asp?action=new&touser=<%=htmlencode(rs("sender"))%>&id=<%=request("id")%>"><img src="images/m_reply.gif" border=0 alt="回复消息"></a>&nbsp;<a href="messanger.asp?action=fw&id=<%=request("id")%>"><img src=images/m_fw.gif border=0 alt=转发消息></a></td>
            </tr>
                <tr>
                    <td class=tablebody2 height=25>
<%if request("action")="outread" then%>
                    在<b><%=rs("sendtime")%></b>，您发送此消息给<b><%=htmlencode(rs("incept"))%></b>！
<%else%>
		    在<b><%=rs("sendtime")%></b>，<b><%=htmlencode(rs("sender"))%></b>给您发送的消息！
<%end if%></td>
                </tr>
                <tr>
                    <td  class=tablebody1 valign=top align=left>
                    <b>消息标题：<%=htmlencode(rs("title"))%></b><hr size=1>
                    <%=Ubbcode(rs("content"))%>
		    </td>
                </tr>
<%
rs.close
set rs=nothing
	sql="select id,sender from Ms_message where incept='"&trim(membername)&"' and flag=0 and issend=1 and id>"&cstr(request("id")&" order by sendtime")
	set rs=conn.execute(sql)
	if not (rs.eof and rs.bof) then
%>
                <tr>
                    <td  class=tablebody2 valign=top align=right><a href=messanger.asp?action=read&id=<%=rs(0)%>&sender=<%=rs(1)%>>[读取下一条信息]</a>
		    </td>
                </tr>
<%
end if
rs.close
set rs=nothing
%>
                </table>
<%end if%>
<%
end sub
'转发信息
sub fw()
stats="发送短信"
dim title,content,sender
if request("id")<>"" and isNumeric(request("id")) then
if Cint(GroupSetting(143))=0 then
  	errmsg=errmsg+"<br>"+"<li>您没有转发短信权限，等级不够，请稍后<a href=login.asp target=_blank>登录</a>。"
	founderr=true
	exit sub
end if
set rs=server.createobject("adodb.recordset")
sql="select title,content,sender from Ms_message where (incept='"&trim(membername)&"' or sender='"&trim(membername)&"') and id="&request("id")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>请选择相关参数。"
Founderr=true
exit sub
else
title=rs("title")
content=rs("content")
sender=rs("sender")
end if
rs.close
set rs=nothing
end if
%>
<form action="messanger.asp" method=post name=messager>
        <table cellpadding=3 cellspacing=1 align=center class=tableborder1 Style="width:98%">
    <tr> 
            <th colspan=2 height=25>
              <input type=hidden name="action" value="send">
              发送短消息--请完整输入下列信息</th>
          </tr>
          <tr> 
            <td class=tablebody1 valign=middle width=15%><b>收件人：</b></td>
            <td  class=tablebody1 valign=middle>
              <input type=text name="touser" value="<%=request("touser")%>" size=50>
              <SELECT name=font onchange=DoTitle(this.options[this.selectedIndex].value)>
              <OPTION selected value="">选择</OPTION>
<%
set rs=server.createobject("adodb.recordset")
sql="select friend from Ms_Friend where username='"&trim(membername)&"' and Fsub=1 order by addtime desc"
rs.open sql,conn,1,1
do while not rs.eof
%>
			  <OPTION value="<%=rs(0)%>"><%=rs(0)%></OPTION> 
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
			  </SELECT>
            </td>
          </tr>
          <tr> 
            <td class=tablebody1 valign=top><b>标题：</b></td>
            <td class=tablebody1 valign=middle>
              <input type=text name="title" size=50 maxlength=80 value="Fw：<%=title%>">&nbsp;
            </td>
          </tr>
          <tr> 
            <td class=tablebody1 valign=top><b>内容：</b></td>
            <td class=tablebody1 valign=middle>
              <textarea cols=70 rows=6 name="message" title="Ctrl+Enter发送">


========== 下面是转发信息 =========
原发件人：<%=sender%><%=chr(13)&chr(13)%>
<%=server.htmlencode(content)%>
===================================</textarea>
            </td>
          </tr>
          <tr> 
            <td  class=tablebody1 colspan=2>
<b>说明</b>：
<li>您可以使用<b>Ctrl+Enter</b>键快捷发送短信</li>
<li>可以用英文状态下的逗号将用户名隔开实现群发，最多<b><%=GroupSetting(125)%></b>个用户</li>
<li> 标题最多<b>50</b>个字符，内容最多<b><%if GroupSetting(126)=0 then
response.Write("不限")
else
response.write(GroupSetting(126))
end if%></b>个字符</li>
        <li>发布短信操作金钱/篇 <b><%=GroupSetting(127)%> <%=GroupSetting(128)%></b> 元</li>
		<li>发布短信操作魅力/篇 <b><%=GroupSetting(129)%> <%=GroupSetting(130)%></b> 点</li>
		<li>发布短信操作经验/篇 <b><%=GroupSetting(131)%> <%=GroupSetting(132)%></b> 点</li>
            </td>
          </tr>
          <tr> 
            <td class=tablebody2 valign=middle colspan=2 align=center> 
              <input type=Submit value="发送" name=Submit>
              &nbsp; 
              <input type=Submit value="保存" name=Submit>
              &nbsp; 
              <input type="reset" name="Clear" value="清除">
              &nbsp; 
              <input type="button" name="close" value="关闭" onclick="window.close()">
            </td>
          </tr>
        </table>
</form>
<%
end sub

sub savemsg()
stats="发送短信成功"
dim incept,title,message,subtype
dim smsid,smsrl
if Cint(GroupSetting(124))=0 then
  	errmsg=errmsg+"<br>"+"<li>您没有发送短信的权限，请与管理员联系。"
	founderr=true
	exit sub
end if
if Cint(GroupSetting(134))<>0 and dateadd("n",Cint(GroupSetting(134)),myjoinDate)>=Now() then
  	errmsg=errmsg+"<br>"+"<li>新注册用户"&Cint(GroupSetting(134))&"分钟后才能发短信，请稍后<a href=login.asp target=_blank>登录</a>。"
	founderr=true
	exit sub
end if
if Cint(Codeshow(2))=1 then
	if Not CodeIsTrue() then
		errmsg=errmsg+"<br>"+"<li>验证码校验失败，请返回刷新页面后再输入验证码。"
		founderr=true
	end if
end if
if request("touser")="" then
	errmsg=errmsg+"<br>"+"<li>您忘记填写发送对象了吧。"
	founderr=true
	exit sub
else
	incept=CheckStr(request("touser"))
	incept=split(incept,",")
end if
if request("title")="" then
	errmsg=errmsg+"<br>"+"<li>您还没有填写标题呀。"
	founderr=true
	exit sub
elseif strlength(request("title"))>50 then
	errmsg=errmsg+"<br>"+"<li>标题限定最多50个字符。"
	founderr=true
	exit sub
else
	title=CheckStr(request("title"))
end if
if request("message")="" then
	errmsg=errmsg+"<br>"+"<li>内容是必须要填写的噢。"
	founderr=true
	exit sub
elseif Cint(GroupSetting(126))<>0 and strlength(request("message"))>Cint(GroupSetting(126)) then
	errmsg=errmsg+"<br>"+"<li>内容限定最多"&GroupSetting(126)&"个字符。"
	founderr=true
	exit sub
else
	message=CheckStr(request("message"))
end if
'查检统计用户发送短信多少

sql="select count(id) from [Ms_Message] where datediff('d',sendtime,Now())=1 and sender='"&trim(membername)&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
smsid=rs(0)
else
smsid=0
end if
set rs=nothing
if Cint(GroupSetting(135))<>0 and smsid>=Cint(GroupSetting(135)) then
	errmsg=errmsg+"<br>"+"<li>用户一天最多发短信条数不大于"&GroupSetting(135)&"条。"
	founderr=true
	exit sub
end if

'查检统计用户信箱短信容量
smsrl=0
sql="select Count(id) from Ms_message where (sender='"&trim(membername)&"' and issend=0 and delS=0) or (incept='"&trim(membername)&"')"
set rs=conn.execute(sql)'草稿箱及收件箱统计
if rs.eof and rs.bof then
do while not rs.eof
smsrl=rs(0)
rs.movenext
loop
end if
rs.close
sql="select Count(id) from Ms_message where ((sender='"&trim(membername)&"' and delS=1) or (incept='"&trim(membername)&"' and delR=1)) and not delS=2"
set rs=conn.execute(sql)'垃圾箱统计
if rs.eof and rs.bof then
do while not rs.eof
smsrl=smsrl+rs(0)
rs.movenext
loop
end if
rs.close
if smsrl>=Cint(GroupSetting(133)) then
	errmsg=errmsg+"<br>"+"<li>您的信箱大小限制"&GroupSetting(133)&" 条，请及时清理。"
	founderr=true
	exit sub
end if
'查检统计用户信箱短信容量结束
if Chkvalue(1,GroupSetting(127),Cint(GroupSetting(128)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(129),Cint(GroupSetting(130)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(131),Cint(GroupSetting(132)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
if founderr=true then exit sub
for i=0 to ubound(incept)
sql="select username from [Ms_user] where username='"&replace(incept(i),"'","")&"'"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
	errmsg=errmsg+"<br>"+"<li>交友中心没有这个用户，看看你的发送对象写对了嘛？"
	founderr=true
	exit sub
end if
set rs=nothing

if i>Cint(GroupSetting(125))-1 then
	errmsg=errmsg+"<br>"+"<li>最多只能发送给"&GroupSetting(125)&"个用户，您的名单"&GroupSetting(125)&"位以后的请重新发送"
	founderr=true
	exit sub
	exit for
end if
if request("Submit")="发送" then
	sql="insert into Ms_message (incept,sender,title,content,sendtime,flag,issend) values ('"&incept(i)&"','"&trim(membername)&"','"&title&"','"&message&"',Now(),0,1)"
	subtype="已发送信息"
elseif request("Submit")="保存" then
	sql="insert into Ms_message (incept,sender,title,content,sendtime,flag,issend) values ('"&incept(i)&"','"&trim(membername)&"','"&title&"','"&message&"',Now(),0,0)"
	subtype="发件箱"
else
	sql="insert into Ms_message (incept,sender,title,content,sendtime,flag,issend) values ('"&incept(i)&"','"&trim(membername)&"','"&title&"','"&message&"',Now(),0,1)"
	subtype="已发送信息"
end if
conn.execute(sql)
conn.execute("update Ms_user set UserWealth=UserWealth "&GroupSetting(127)&Cint(GroupSetting(128))&",UserEP=UserEP "&GroupSetting(129)&Cint(GroupSetting(130))&",UserCP=UserCP "&GroupSetting(131)&Cint(GroupSetting(132))&" where Userid="&Userid&"")
next
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，发送短信息成功。</b><br>发送的消息同时保存在您的"&subtype&"中。"
call Mslove_suc()
end sub

'更改信息
sub edit()
stats="修改短信"
dim incept,title,content,id
if request("id")<>"" and isNumeric(request("id")) then
set rs=server.createobject("adodb.recordset")
sql="select id,incept,title,content from Ms_message where sender='"&trim(membername)&"' and issend=0 and id="&request("id")
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
incept=rs("incept")
title=rs("title")
content=rs("content")
id=rs("id")
else
Errmsg=Errmsg+"<br>"+"<li>没有找到您要编辑的信息。"
Founderr=true
exit sub
end if
rs.close
set rs=nothing
else
Errmsg=Errmsg+"<br>"+"<li>请指定相关参数。"
Founderr=true
exit sub
end if
%>
<form action="messanger.asp" method=post name=messager>
  <table cellpadding=3 cellspacing=1 align=center class=tableborder1 Style="width:98%">
    <tr> 
            <th colspan=2 height=25> 
              <input type=hidden name="action" value="savedit"> 
              <input type=hidden name="id" value="<%=id%>">
              发送短消息--请完整输入下列信息</th>
          </tr>
          <tr> 
            <td  class=tablebody1 valign=middle width=70><b>收件人：</b></td>
            <td  class=tablebody1 valign=middle>
              <input type=text name="touser" value="<%=incept%>" size=50>
            </td>
          </tr>
          <tr> 
            <td class=tablebody1 valign=top><b>标题：</b></td>
            <td  class=tablebody1 valign=middle>
              <input type=text name="title" size=50 maxlength=80 value="<%=title%>">
            </td>
          </tr>
          <tr> 
            <td  class=tablebody1 valign=top><b>内容：</b></td>
            <td  class=tablebody1 valign=middle>
              <textarea cols=70 rows=8 name="message" title=""><%=server.htmlencode(content)%></textarea>
            </td>
          </tr>
          <tr> 
            <td  class=tablebody1 colspan=2>
<b>说明</b>：
<li>您可以使用<b>Ctrl+Enter</b>键快捷发送短信</li>
<li>可以用英文状态下的逗号将用户名隔开实现群发，最多<b><%=GroupSetting(125)%></b>个用户</li>
<li> 标题最多<b>50</b>个字符，内容最多<b><%if GroupSetting(126)=0 then
response.Write("不限")
else
response.write(GroupSetting(126))
end if%></b>个字符</li>
        <li>发布短信操作金钱/篇 <b><%=GroupSetting(127)%> <%=GroupSetting(128)%></b> 元</li>
		<li>发布短信操作魅力/篇 <b><%=GroupSetting(129)%> <%=GroupSetting(130)%></b> 点</li>
		<li>发布短信操作经验/篇 <b><%=GroupSetting(131)%> <%=GroupSetting(132)%></b> 点</li>
            </td>
          </tr>
          <tr> 
            <td  class=tablebody2 valign=middle colspan=2 align=center> 
              <input type=Submit value="发送" name=Submit>
              &nbsp; 
              <input type=Submit value="保存" name=Submit>
              &nbsp; 
              <input type="reset" name="Clear" value="清除">
              &nbsp; 
              <input type="button" name="close" value="关闭" onclick="window.close()">
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
<%
end sub

sub savedit()
dim incept,title,message,subtype
if request("id")="" or not isNumeric(request("id")) then
	Errmsg=Errmsg+"<br>"+"<li>请指定相关参数。"
	Founderr=true
	exit sub
end if
if request("touser")="" then
	errmsg=errmsg+"<br>"+"<li>您忘记填写发送对象了吧。"
	founderr=true
	exit sub
else
	incept=checkStr(request("touser"))
end if
if request("title")="" then
	errmsg=errmsg+"<br>"+"<li>您还没有填写标题呀。"
	founderr=true
	exit sub
else
	title=checkStr(request("title"))
end if
if request("message")="" then
	errmsg=errmsg+"<br>"+"<li>内容是必须要填写的噢。"
	founderr=true
	exit sub
else
	message=checkStr(request("message"))
end if

sql="select username from [Ms_user] where username='"&incept&"'"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
	errmsg=errmsg+"<br>"+"<li>交友中心没有这个用户，看看你的发送对象写对了嘛？"
	founderr=true
	exit sub
end if
set rs=nothing

if request("Submit")="发送" then
	sql="update Ms_message set incept='"&incept&"',sender='"&trim(membername)&"',title='"&title&"',content='"&message&"',sendtime=Now(),flag=0,issend=1 where id="&request("id")
	subtype="已发送信息"
	else
	sql="update Ms_message set incept='"&incept&"',sender='"&trim(membername)&"',title='"&title&"',content='"&message&"',sendtime=Now(),flag=0,issend=0 where id="&request("id")
	subtype="发件箱"
end if
conn.execute(sql)

sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，发送短信息成功。</b><br>发送的消息同时保存在您的"&subtype&"中。"
call Mslove_suc()
end sub

'收件逻辑删除，置于回收站，入口字段delR，可用于批量及单个删除
sub delinbox()
dim delid,FixID
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
	exit sub
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关参数。"
Founderr=true
else
	conn.execute("update Ms_message set delR=1 where incept='"&trim(membername)&"' and id in ("&delid&")")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将转移到您的回收站。"
	call Mslove_suc()
end if
end sub
sub AllDelinbox()
	conn.execute("update Ms_message set delR=1 where incept='"&trim(membername)&"' and delR=0")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将转移到您的回收站。"
	call Mslove_suc()
end sub

'发件逻辑删除，置于回收站，入口字段delS，可用于批量及单个删除
sub deloutbox()
dim delid,fixid
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
	exit sub
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关参数。"
Founderr=true
else
	conn.execute("update Ms_message set delS=1 where sender='"&trim(membername)&"' and issend=0 and id in ("&delid&")")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将转移到您的回收站。"
	call Mslove_suc()
end if
end sub
sub AllDeloutbox()
	conn.execute("update Ms_message set delS=1 where sender='"&trim(membername)&"' and delS=0 and issend=0")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将转移到您的回收站。"
	call Mslove_suc()
end sub

'已发送逻辑删除，置于回收站，入口字段delS，可用于批量及单个删除
'delS：0未操作，1发送者删除，2发送者从回收站删除
sub delissend()
dim delid,fixid
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
	exit sub
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关参数。"
Founderr=true
else
	conn.execute("update Ms_message set delS=1 where sender='"&trim(membername)&"' and issend=1 and id in ("&delid&")")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将转移到您的回收站。"
	call Mslove_suc()
end if
end sub
sub AllDelissend()
	conn.execute("update Ms_message set delS=1 where sender='"&trim(membername)&"' and delS=0 and issend=1")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将转移到您的回收站。"
	call Mslove_suc()
end sub

'用户能完全删除收到信息和逻辑删除所发送信息，逻辑删除所发送信息设置入口字段delS参数为2
sub delrecycle()
dim delid,fixid,delidnum,delidnums
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
	exit sub
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关参数。"
Founderr=true
exit sub
else
delidnum=split(delid,",")
delidnums=ubound(delidnum)
if delidnums>0 then
delidnums=(delidnums+1)
else
delidnums=0
end if
if Chkvalue(1,GroupSetting(136),(Cint(GroupSetting(137))*delidnums))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(138),(Cint(GroupSetting(139))*delidnums))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(140),(Cint(GroupSetting(141))*delidnums))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
if founderr=true then exit sub
	conn.execute("delete from Ms_message where incept='"&trim(membername)&"' and delR=1 and id in ("&delid&")")
	conn.execute("update Ms_message set delS=2 where sender='"&trim(membername)&"' and delS=1 and id in ("&delid&")")
	conn.execute("update Ms_user set UserWealth=UserWealth "&GroupSetting(136)&(Cint(GroupSetting(137))*delidnums)&",UserEP=UserEP "&GroupSetting(138)&(Cint(GroupSetting(139))*delidnums)&",UserCP=UserCP "&GroupSetting(140)&(Cint(GroupSetting(141))*delidnums)&" where Username='"&trim(membername)&"'")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将不可恢复。"
	call Mslove_suc()
end if
end sub

sub AllDelrecycle()''清空回收站
dim countid
sql="select count(id) from [Ms_message] where incept='"&trim(membername)&"' and delR=1"
set rs=conn.execute(sql)
if not(rs.eof and rs.bof) then
countid=rs(0)
else
countid=0
end if
set rs=nothing
if Chkvalue(1,GroupSetting(136),(Cint(GroupSetting(137))*countid))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(138),(Cint(GroupSetting(139))*countid))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(140),(Cint(GroupSetting(141))*countid))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
	conn.execute("delete from Ms_message where incept='"&trim(membername)&"' and delR=1")	
	conn.execute("update Ms_message set delS=2 where sender='"&trim(membername)&"' and delS=1")
	conn.execute("update Ms_user set UserWealth=UserWealth "&GroupSetting(136)&(Cint(GroupSetting(137))*countid)&",UserEP=UserEP "&GroupSetting(138)&(Cint(GroupSetting(139))*countid)&",UserCP=UserCP "&GroupSetting(140)&(Cint(GroupSetting(141))*countid)&" where Username='"&trim(membername)&"'")
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将不可恢复。"
	call Mslove_suc()
end sub

sub delete()
dim delid
delid=checkstr(request("id"))
if not isNumeric(request("id")) or delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关参数。"
Founderr=true
else
	conn.execute("update Ms_message set delR=1 where incept='"&trim(membername)&"' and id="&delid)
	conn.execute("update Ms_message set delS=1 where sender='"&trim(membername)&"' and id="&delid)
	sucmsg=sucmsg+"<br>"+"<li>删除短信息成功。删除的消息将置于您的回收站内。"
	call Mslove_suc()
end if
end sub
%>
<script language="javascript"> 
function DoTitle(addTitle) {  
 var revisedTitle;  
 var currentTitle = document.messager.touser.value; 

 if(currentTitle=="") revisedTitle = addTitle; 
 else { 
  var arr = currentTitle.split(","); 
  for (var i=0; i < arr.length; i++) { 
   if( addTitle.indexOf(arr[i]) >=0 && arr[i].length==addTitle.length ) return; 
  } 
  revisedTitle = currentTitle+","+addTitle; 
 } 

 document.messager.touser.value=revisedTitle;  
 document.messager.touser.focus(); 
 return; 
} 
</script>