<!--#include file="top.asp"-->
<!--#include file="../Inc/SendMail.asp"--><%usertopview%>
<%if userflag28=0 then
response.redirect"ok.asp?action=flag"
end if
'response.Write(session("id"))
'response.end()
set rs1=server.createobject("adodb.recordset")
set rs=server.createobject("adodb.recordset")

action=request("action")
id=request("id")
key=request("key")

if action="del" then
id=split(id,",")
for i=0 to ubound(id)

sql="select * from dlxf_message where dlxf_id="&id(i)&""
rs.open sql,conn,1,1
if not rs.eof then
if rs("dlxf_yp_id")=0 and rs("dlxf_Send_id")=0 then
errstyle="·系统信息不能删除！"
scripterr
end if
if rs("dlxf_send_id")=session("id") then
errstyle="·这是您发布的信息，不可以删除！"
scripterr
end if

conn.execute("delete from dlxf_message where dlxf_yp_id="&session("id")&" and dlxf_id="& id(i))
end if
rs.close

next
response.redirect"my_message.asp"
'==================================================
elseif action="sendsave" then
dlxf_yp_id=request("dlxf_yp_id")
'response.Write(dlxf_yp_id)
'response.Write("1")
'response.End()
dlxf_message=code_jk(request("dlxf_message"))
dlxf_title=request("dlxf_title")
dlxf_yp_id=split(dlxf_yp_id,",")
'response.Write(dlxf_yp_id(0))
'response.End()
set rscon = Server.CreateObject("ADODB.Recordset")
sqlcon="select* from dlxf_config" 
rscon.open sqlcon,conn,1,1
conname=rscon("dlxf_cityname")
conhttp=rs("dlxf_cityurl")
rscon.close
for i=0 to ubound(dlxf_yp_id)
'response.write(ubound(dlxf_yp_id))
'response.Write(dlxf_yp_id(i))
'response.End()
sql="select * from dlxf_yp where dlxf_coname='"&dlxf_yp_id(i)&"'"
rs.open sql,conn,1,3
if not rs.eof then
dlxf_id=rs("dlxf_id")
'response.Write(dlxf_id)
'response.End()
end if
rs.close

if dlxf_id=session("id") then
errstyle="·您不能给自己发短信息哦！"
scripterr
end if
'抄送到邮箱

if request("sendto")<>"" then
sendto=request("sendto")
if sendto="y" then
set rssend=server.createobject("adodb.recordset")
sqlsend="select dlxf_mail from dlxf_yp where dlxf_id='"&dlxf_id&"'"
rssend.open sqlsend,conn,1,3
if not rssend.eof then
mail=rssend("dlxf_mail")
Topic=dlxf_title
dlxf_cityregmail="尊敬的客户，您在我们的网站"&conname&"上面发布的信息有客户给您留言，内容如下："
dlxf_cityregmail=dlxf_cityregmail&dlxf_message
dlxf_cityregmail=dlxf_cityregmail&"请您登陆我们的网址"&conhttp&"进行查看，感谢您的支持!"
end if
select case dlxf_citysendmail(4)
  case "Jmail"
     call Jmail(mail,Topic,dlxf_cityregmail)
  case "Cdonts"
     call Cdonts(mail,Topic,dlxf_cityregmail)
  case "AspEmail"
     call AspEmail(mail,Topic,dlxf_cityregmail)
end select

if sendmail="False" then
response.write"<script>alert('抄送邮件发送出错，下面是产生错误的可能原因：\n\n·您输入的客户联系邮箱有错误或根本不存在，请重新输入\n\n·联系管理员查看邮件发送功能设置');history.go(-1)</script>"
response.end
end if
rssend.close
end if 
end if

'response.Write(dlxf_yp_id)
'response.End()
sql="select * from dlxf_message"
rs.open sql,conn,1,3
rs.addnew
rs("dlxf_yp_id")=dlxf_id
rs("dlxf_send_id")=session("id")
rs("dlxf_message")=dlxf_message
rs("dlxf_title")=dlxf_title
rs.update
rs.close
next
response.redirect "my_message.asp?action=send"
end if%>
<script language = "JavaScript" src = "user_admin.js" type="text/javascript"></script>
<script language="JavaScript">
<!--
function checkdata() {
if( addform.dlxf_yp_id.value =="") {
alert("\操作错误，下面是产生错误的可能原因：\n\n·请填写收件人")
return false;
}
if( addform.dlxf_title.value =="") {
alert("\操作错误，下面是产生错误的可能原因：\n\n·请输入短信标题")
return false;
}
if( addform.dlxf_message.value =="") {
alert("\操作错误，下面是产生错误的可能原因：\n\n·请输入短息内容")
return false;
}
return true;
}
  function textLimitCheck(thisArea, maxLength){
    if (thisArea.value.length > maxLength){
      alert(maxLength + ' 个字限制. \r超出的将自动去除.');
      thisArea.value = thisArea.value.substring(0, maxLength);
      thisArea.focus();
    }
messageCount.innerText = thisArea.value.length;
  }
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
// -->
</script>

<table width="760" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td width="150" valign=top bgcolor=#efefef>
<!--==============-->
<!--#include file="left.asp"-->
<!--==============-->
</td>
<td width="600" valign=top>
<!--==============-->
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height=25>您现在的位置是：我的公文包 > 短信中心</td></tr>
  <tr>
    <td>
<!--####################################-->
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr>
    <td bgcolor=#ffffff>
<!--======-->
<table width="80%" border="0" cellspacing="0" cellpadding="5" align=center>
  <tr align=center>
<td><a href=my_message.asp><img src="../img/msg_take.gif" border=0><br>收件箱</a></td>
<td><a href=my_message.asp?action=send><img src="../img/msg_send.gif" border=0><br>发件箱</a></td>
<td><a href=my_message.asp?action=write><img src="../img/msg_write.gif" border=0><br>撰写</a></td>
<td><a href=<%if id<>"" then%>my_message.asp?action=re&id=<%=id%><%else%>#<%end if%>><img src="../img/msg_re<%if id="" then%>_no<%end if%>.gif" border=0><br>回复</a></td>
<td><a href=<%if id<>"" then%>my_message.asp?action=transmit&id=<%=id%><%else%>#<%end if%>><img src="../img/msg_transmit<%if id="" then%>_no<%end if%>.gif" border=0><br>转发</a></td>
<td><a href=<%if id<>"" then%>my_message.asp?action=del&id=<%=id%><%else%>#<%end if%>><img src="../img/msg_del<%if id="" then%>_no<%end if%>.gif" border=0><br>删除</a></td>
  </tr>
</table>
<!--======-->
	</td>
  </tr>
</table>
<!--####################################-->
	</td>
  </tr>
  <tr>
    <td height=10></td>
  </tr>
  <tr>
    <td>
<%if action="write" then%>
<!--========================短信发送======================-->
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr><td height=25 bgcolor=#6C94D1>　　<font color=white>写新短信</font></td></tr>
  <tr><td bgcolor=#ffffff height=25>
<!--======-->
<table width="90%" border="0" cellspacing="0" cellpadding="5" align=center>
<form name="addform" method="post" action="my_message.asp?action=sendsave" onSubmit="return checkdata()">
  <tr>
    <td width="19%" align=right><font color=red>*</font> 收件人：</td>
	<td width="81%"><input name="dlxf_yp_id" type="text" size="30" ID="magicfacepic(1)" onClick="lookmagic(1)" style="cursor:hand"> <img src="img/card.gif" align=absmiddle alt="从我的名片选择" onClick="lookmagic(1)" style="cursor:hand"> 多个请用 "," 隔开
	<div id="magicframe(1)" style="visibility:hidden; position: absolute;width:10; left: 2px; top: 479px;"><iframe src="my_friend_view.asp?action=1" width="380" height="210" frameborder="0" scrolling="no"></iframe></div></td>
  </tr>
  <tr>
    <td width="19%" align=right><font color=red>*</font> 标 题：</td>
	<td width="81%"><input name="dlxf_title" type="text" size="42" maxlength="30"></td>
  </tr>
  <tr>
    <td width="19%" align=right><font color=red>*</font> 内 容：</td>
	<td width="81%"><p style="line-height:180%"><textarea name="dlxf_message" cols=40 rows=5 onkeyUp="textLimitCheck(this, 150);"></textarea><br>限 150 个字符  已输入 <font color="#CC0000"><span id="messageCount">0</span></font> 个字</td>
  </tr>
  <tr>
    <td></td>
	<td><input type="submit" name="Submit" value="发 送" class="input1">　
	<a href=my_friend.asp class=red>添加名片</a>
	发送同时抄送到对方邮箱
	  <input name="sendto" type="checkbox" value="y"></td>
  </tr>
</form>
</table>
</td>
  </tr>
</table>
<!--========================短信发送 end======================-->
<%elseif action="re" then%>
<!--========================短信回复======================-->
<%sql="select * from dlxf_message where dlxf_id="&id&""
rs.open sql,conn,1,1
if not rs.eof then
dlxf_title="Re："&rs("dlxf_title")
'===============
if rs("dlxf_yp_id")=0 and rs("dlxf_Send_id")=0 then
errstyle="·系统信息不能回复！"
scripterr
end if
if rs("dlxf_yp_id")<>session("id") then
errstyle="·这不是您的信息，不可以回复！"
scripterr
end if
'===============
sql1="select *  from dlxf_yp where dlxf_ID="&rs("dlxf_send_id")
rs1.open sql1,conn,1,1
if not rs1.eof then
dlxf_coname=rs1("dlxf_coname")
end if
rs1.close%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr><td height=25 bgcolor=#6C94D1>　　<font color=white>回复短信</font></td></tr>
  <tr><td bgcolor=#ffffff height=25>
<!--======-->
<table width="90%" border="0" cellspacing="0" cellpadding="5" align=center>
<form name="addform" method="post" action="my_message.asp?action=sendsave" onSubmit="return checkdata()">
  <tr>
    <td width="19%" align=right><font color=red>*</font> 收件人：</td>
	<td width="81%"><input name="dlxf_yp_id" type="text" size="35" value="<%=dlxf_coname%>"></td>
  </tr>
  <tr>
    <td width="19%" align=right><font color=red>*</font> 标 题：</td>
	<td width="81%"><input name="dlxf_title" type="text" size="42" maxlength="30" value="<%=dlxf_title%>"></td>
  </tr>
  <tr>
    <td width="19%" align=right><font color=red>*</font> 内 容：</td>
	<td width="81%"><p style="line-height:180%"><textarea name="dlxf_message" cols=40 rows=5 onkeyUp="textLimitCheck(this, 150);"></textarea><br>限 150 个字符  已输入 <font color="#CC0000"><span id="messageCount">0</span></font> 个字</td>
  </tr>
  <tr>
    <td></td>
	<td><input type="submit" name="Submit" value="回 复" class="input1"> 
	  &nbsp;&nbsp;发送同时抄送到对方邮箱
	  <input name="sendto" type="checkbox" value="y"></td>
  </tr>
  <tr><td bgcolor=#efefef colspan=2><strong>原件：</strong><%=trim(rs("dlxf_title"))%></td></tr>
  <tr><td colspan=2><p style="line-height:150%">　　<%=trim(rs("dlxf_message"))%></td></tr>
</form>
</table>
</td>
  </tr>
</table>
<%end if
rs.close%>
<!--========================短信回复 end======================-->
<%elseif action="transmit" then%>
<!--========================短信转发======================-->
<%sql="select * from dlxf_message where dlxf_id="&id&""
rs.open sql,conn,1,1
if not rs.eof then
dlxf_title="Fw："&rs("dlxf_title")
'===============
if rs("dlxf_yp_id")=0 and rs("dlxf_Send_id")=0 then
errstyle="·系统信息不能转发！"
scripterr
end if
if rs("dlxf_yp_id")<>session("id") then
errstyle="·这不是您的信息，不可以转发！"
scripterr
end if%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr><td height=25 bgcolor=#6C94D1>　　<font color=white>转发短信</font></td></tr>
  <tr><td bgcolor=#ffffff height=25>
<!--======-->
<table width="90%" border="0" cellspacing="0" cellpadding="5" align=center>
<form name="addform" method="post" action="my_message.asp?action=sendsave" onSubmit="return checkdata()">
  <tr>
    <td width="19%" align=right><font color=red>*</font> 收件人：</td>
	<td width="81%"><input name="dlxf_yp_id" type="text" size="30" ID="magicfacepic(1)" onClick="lookmagic(1)" style="cursor:hand"> <img src="img/card.gif" align=absmiddle alt="从我的名片选择" onClick="lookmagic(1)" style="cursor:hand"> 多个请用 "," 隔开
	<div id="magicframe(1)" style="visibility:hidden; position: absolute;width:10; left: 2px; top: 479px;"><iframe src="my_friend_view.asp?action=1" width="380" height="210" frameborder="0" scrolling="no"></iframe></div></td>
  </tr>
  <tr>
    <td width="19%" align=right><font color=red>*</font> 标 题：</td>
	<td width="81%"><input name="dlxf_title" type="text" size="42" maxlength="30" value="<%=dlxf_title%>"></td>
  </tr>
  <tr>
    <td width="19%" align=right><font color=red>*</font> 内 容：</td>
	<td width="81%"><p style="line-height:180%"><textarea name="dlxf_message" cols=40 rows=5 onkeyUp="textLimitCheck(this, 150);"></textarea><br>限 150 个字符  已输入 <font color="#CC0000"><span id="messageCount">0</span></font> 个字</td>
  </tr>
  <tr>
    <td></td>
	<td><input type="submit" name="Submit" value="回 复" class="input1"> &nbsp;&nbsp;发送同时抄送到对方邮箱
      <input name="sendto" type="checkbox" value="y"></td>
  </tr>
  <tr><td bgcolor=#efefef colspan=2><strong>原件：</strong><%=trim(rs("dlxf_title"))%></td></tr>
  <tr><td colspan=2><p style="line-height:150%">　　<%=trim(rs("dlxf_message"))%></td></tr>
</form>
</table>
</td>
  </tr>
</table>
<%end if
rs.close%>
<!--========================短信转发 end======================-->
<%elseif action="send" then%>
<!--========================发件箱======================-->
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr><td height=25 bgcolor=#6C94D1>　　<font color=white>我的发件箱</font></td></tr>
  <tr><td bgcolor=#ffffff height=25>
<!--======-->
<table width="100%" border="0" cellspacing="1" cellpadding="5" align=center bgcolor=#ffffff>
  <tr align=center bgcolor=#efefef>
    <td width=*>收件人</td>
	<td width="60%">主 题</td>
	<td width="8%">状态</td>
  </tr>
<%sql="select * from dlxf_message where dlxf_send_id="&session("id")&" order by dlxf_id desc"
rs.open sql,conn,1,1                     
if rs.eof and rs.bof then                     
	response.write "<tr><td height=194 colspan=4 align=center bgcolor=#efefef>暂无内容</td></tr>"
else  
'分页的实现 
listnum=20
Rs.pagesize=listnum
page=Request("page")
if (page-Rs.pagecount) > 0 then
page=Rs.pagecount
elseif page = "" or page < 1 then
page = 1
end if
Rs.absolutepage=page
'编号的实现
j=rs.recordcount
j=j-(page-1)*listnum
i=0
do while not rs.eof and i<listnum

sql1="select *  from dlxf_yp where dlxf_ID="&rs("dlxf_yp_id")
rs1.open sql1,conn,1,1
if not rs1.eof then
dlxf_coname=rs1("dlxf_coname")
end if
rs1.close%>
  <tr bgcolor=#fafafa>
    <td><%=leftT(dlxf_coname,22)%></td>
	<td><a href=my_message.asp?action=see&id=<%=rs("dlxf_id")%>><%=leftT(rs("dlxf_title"),44)%></a></td>
	<td align=center><%if rs("dlxf_key")=0 then%><font color=red>未读</font><%else%>已读<%end if%></td>
  </tr>
<%rs.movenext 
i=i+1 
j=j-1
loop%>
<%filename="my_message.asp?action="&action&""%>
<tr><td colspan=3 align=right bgcolor=#efefef><%=page%>/<%=Rs.pagecount%> 页 
      <% if page=1 then %>
      <%else%>
      <a href=<%=filename%>>|<<</a>
      <a href=<%=filename%>&page=<%=page-1%>><<</a>
      <a href=<%=filename%>&page=<%=page-1%>>[<%=page-1%>]</a>
<%end if%><% if Rs.pagecount=1 then %>
<%else%>[<%=page%>]
<%end if%>
	  <% if Rs.pagecount-page <> 0 then %>
      <a href=<%=filename%>&page=<%=page+1%>>[<%=page+1%>]</a>
      <a href=<%=filename%>&page=<%=page+1%>>>></a>
      <a href=<%=filename%>&page=<%=Rs.pagecount%>>>>|</a>
	  <%end if%></td>
<%end if%></tr>
</table>
</td></tr></table>
<!--========================发件箱 end======================-->
<%elseif action="see" then%>
<!--========================查看======================-->
<%if key="yes" then
conn.execute("update dlxf_message set dlxf_key=1 where dlxf_id="&id)
sql="select * from dlxf_message where dlxf_id="&id&" and (dlxf_yp_id="&session("id")&" or dlxf_yp_id=0)"
else
sql="select * from dlxf_message where dlxf_id="&id&" and (dlxf_send_id="&session("id")&" or dlxf_send_id=0)"
end if

rs.open sql,conn,1,1
if rs.eof then
response.write "<table width=""100%"" border=0 cellspacing=1 cellpadding=0 bgcolor=#6C94D1><tr><td height=194 colspan=4 align=center bgcolor=#efefef>您没有权限查看此内容</td></tr></table>"
else
sql1="select *  from dlxf_yp where dlxf_ID="&rs("dlxf_send_id")
rs1.open sql1,conn,1,1
if not rs1.eof then
dlxf_sendname=rs1("dlxf_coname")
else
dlxf_sendname="<font color=red>...系统消息...</font>"
end if
rs1.close

sql1="select *  from dlxf_yp where dlxf_ID="&rs("dlxf_yp_id")
rs1.open sql1,conn,1,1
if not rs1.eof then
dlxf_ypname=rs1("dlxf_coname")
else
dlxf_ypname="<font color=red>...系统消息...</font>"
end if
rs1.close
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr><td height=25 bgcolor=#6C94D1>　　<font color=white>阅读短信</font></td></tr>
  <tr><td bgcolor=#ffffff height=25>

<table width="100%" border="0" cellspacing="1" cellpadding="5" align=center bgcolor=ffffff>

<tr bgcolor=#efefef><td width="18%" align=right>发件人：</td><td width="82%"><%=dlxf_sendname%></td></tr>
<tr bgcolor=#efefef><td width="18%" align=right>收件人：</td><td width="82%"><%=dlxf_ypname%></td></tr>
<tr bgcolor=#efefef><td width="18%" align=right>时 间：</td><td width="82%"><%=rs("dlxf_date")%></td></tr>
<tr bgcolor=#efefef><td width="18%" align=right>主 题：</td><td width="82%"><%=rs("dlxf_title")%></td></tr>
<tr bgcolor=#efefef><td align=right>内 容：</td><td><%=rs("dlxf_message")%></td></tr>
</table>

	</td>
  </tr>
</table>
<%end if
rs.close%>
<!--========================查看 end======================-->
<%else%>
<!--========================收件箱======================-->
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr><td height=25 bgcolor=#6C94D1>　　<font color=white>我的收件箱</font></td></tr>
  <tr><td bgcolor=#ffffff height=25>
<!--======-->
<table width="100%" border="0" cellspacing="1" cellpadding="3" align=center bgcolor=#ffffff>
<form name="from1" method="post" action="my_message.asp?action=del">
  <tr align=center bgcolor=#efefef>
    <td width=*>发件人</td>
	<td width="56%">主 题</td>
	<td width="8%">状态</td>
	<td width="4%"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form)" style="border:0"></td>
  </tr>
<%sql="select * from dlxf_message where dlxf_yp_id="&session("id")&" or (dlxf_send_id=0 and dlxf_yp_id=0) order by dlxf_yp_id,dlxf_id desc"
rs.open sql,conn,1,1                     
if rs.eof and rs.bof then                     
	response.write "<tr><td height=194 colspan=4 align=center bgcolor=#efefef>暂无内容</td></tr>"
else  
'分页的实现 
listnum=20
Rs.pagesize=listnum
page=Request("page")
if (page-Rs.pagecount) > 0 then
page=Rs.pagecount
elseif page = "" or page < 1 then
page = 1
end if
Rs.absolutepage=page
'编号的实现
j=rs.recordcount
j=j-(page-1)*listnum
i=0
do while not rs.eof and i<listnum

sql1="select *  from dlxf_yp where dlxf_ID="&rs("dlxf_send_id")
rs1.open sql1,conn,1,1
if not rs1.eof then
dlxf_coname=leftT(rs1("dlxf_coname"),22)
else
dlxf_coname="<font color=green>...系统消息...</font>"
end if
rs1.close%>
  <tr bgcolor=#fafafa>
    <td><%=dlxf_coname%></td>
	<td><a href=my_message.asp?action=see&id=<%=rs("dlxf_id")%>&key=yes><%=leftT(rs("dlxf_title"),42)%></a></td>
	<td align=center><%if rs("dlxf_yp_id")<>0 then%><%if rs("dlxf_key")=0 then%><font color=red>未读</font><%else%>已读<%end if%><%else%>——<%end if%></td>
	<td align=center><input type="checkbox" name="ID" value="<%=rs("dlxf_id")%>" style="border:0"<%if rs("dlxf_yp_id")=0 and rs("dlxf_send_id")=0 then%> disabled<%end if%>></td>
  </tr>
<%rs.movenext 
i=i+1 
j=j-1
loop%>
<%filename="my_message.asp?action="&action&""%>
<tr><td colspan=4 align=right bgcolor=#efefef><%=page%>/<%=Rs.pagecount%> 页 
      <% if page=1 then %>
      <%else%>
      <a href=<%=filename%>>|<<</a>
      <a href=<%=filename%>&page=<%=page-1%>><<</a>
      <a href=<%=filename%>&page=<%=page-1%>>[<%=page-1%>]</a>
<%end if%><% if Rs.pagecount=1 then %>
<%else%>[<%=page%>]
<%end if%>
	  <% if Rs.pagecount-page <> 0 then %>
      <a href=<%=filename%>&page=<%=page+1%>>[<%=page+1%>]</a>
      <a href=<%=filename%>&page=<%=page+1%>>>></a>
      <a href=<%=filename%>&page=<%=Rs.pagecount%>>>>|</a>
	  <%end if%> <input type="submit" name="Submit" value="删 除" class=input1 style="height:18"></td>
<%end if%></tr>
</form>
</table>
<%end if%>
	</td>
  </tr>
</table>
<!--========================收件箱 end======================-->
	</td>
  </tr>
</table>
	</td>
  </tr>
</table>
<!--====== bottom ========-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" background="img/bottom_bg.gif">
<tr><td height=2 bgcolor=#6C94D1></td></tr>
  <tr>
    <td align="center" height=80><%=citybottom%></td>
  </tr>
</table>
<%set rs=nothing
set rs1=nothing%>
</body>
</html>