<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/md5.asp"-->
 <%
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交易助手管理操作平台_<%=webname%></title>
<link rel="stylesheet" href="/css.css" type="text/css">
</head>
<script Language="JavaScript">
function check()
{
  if (trim(snsn.touser.value)=="") {
		alert("对方的会员登陆名不能为空！");
		snsn.touser.focus();		
		    return (false);
  }
  if (trim(snsn.messageTitle.value)=="") {
		alert("主题不能为空！");
		snsn.messageTitle.focus();		
		    return (false);
  }
  if (trim(snsn.messageContent.value)=="") {
		alert("主要内容不能为空！");
		snsn.messageContent.focus();		
		    return (false);
  }
   if (trim(snsn.verifycode.value)=="") {
		alert("附加码不能为空！");
		snsn.verifycode.focus();		
		    return (false);
  }
else
	document.snsn.submit();
}
//-->
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 

//--> 
</script>
<body><!--#include file="../../top.asp"-->

<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td width="970"><table width="970"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="10"><img src="/img/m_left.gif" width="10" height="20"></td>
          <td width="950" bgcolor="#FFFFFF"></td>
          <td width="10"><img src="/img/m_right.gif" width="10" height="20"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="188" colspan="3"><table width="950"  border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="1" bgcolor="efefef"></td>
                <td width="200" height="77" valign="top"><!--#include file="../left.asp"--></td>
                <td width="1" bgcolor="efefef"></td>
                <td valign="top"><p>
                  <%
secuser=nosql(request("selected_friend_id"))
secuser=replace(replace(replace(secuser,"-1+",""),"0+",""),"1+","")
qf=nosql(request("qf"))
if Cint(request("Verifycode"))<>Session("Verifycode") then 
if request.form("Verifycode")="" and request.form("messageContent")="" then 
response.write""
else
response.write"<TABLE width='100%' border=0 align='center' cellPadding=0 cellSpacing=0>"
response.write"<TR><td>"
response.write"<ul>"
response.write"<li><FONT color='ff0000'> 亲爱的会员，您的验证码输入错误，请再试一下</font><br>"
response.write"</li>"
response.write"</ul>"
response.write"</TR></td></table>"
end if
else
if qf<>"qf" then
touser=nosql(request.form("touser"))
set rs=conn.execute("select id,username,email from snsn_user where username='"&touser&"' and id<>"&session("id")&"")
if rs.eof or rs.bof then
  response.write"<SCRIPT language=JavaScript>alert('您填写的对方会员登陆名不正确或会员登陆名是您自己！');"
  response.write"javascript:history.go(-1)</SCRIPT>"
  response.end
else
mycid=rs("id")
email=rs("email")

set rsblak=conn.execute("select id from snsn_myfriend where username='"&rs("username")&"' and friend_name='"&session("user")&"' and relation=-1")
if not (rsblak.eof and rsblak.bof) then
  response.write"<SCRIPT language=JavaScript>alert('对方已把您列入黑名单中，\n\n不能向对方询价。');"
  response.write"javascript:history.go(-1)</SCRIPT>"
  response.end
end if
rsblak.close
set rsblak=nothing
end if
else
mycid=0
end if
title=nosql(request.form("messageTitle"))
if session("id")=1 then
content=request.form("messageContent")&nosql(request("show"))
else
content=nosql(request.form("messageContent"))&nosql(request("show"))
end if
bg=nosql(request("bg"))
sendemail=nosql(request.form("sendemail"))
saveSendMessage=nosql(request.form("saveSendMessage"))
sendContact=nosql(request.form("sendContact"))
checkdate=nosql(request.form("checkdate"))
if saveSendMessage<>"" then
set rs1=server.createobject("adodb.recordset")
sql1="select * from snsn_getprice1 where (id is null)" 
rs1.open sql1,conn,1,3
rs1.addnew
rs1("title")=title
rs1("content")=content
rs1("bg")=bg
if sendemail<>"" then
rs1("sendemail")=sendemail
else
rs1("sendemail")=0
end if
if sendcontact<>"" then
rs1("sendcontact")=sendcontact
else
rs1("sendcontact")=0
end if
if checkdate<>"" then
rs1("checkdate")=checkdate
else
rs1("checkdate")=0
end if
rs1("mycid")=mycid
rs1("sendcid")=session("id")
rs1("datetime")=now()
rs1.update
end if

set rs=server.createobject("adodb.recordset")
sql="select * from snsn_getprice where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("content")=content
rs("bg")=bg
if sendemail<>"" then
rs("sendemail")=sendemail
else
rs("sendemail")=0
end if
if sendcontact<>"" then
rs("sendcontact")=sendcontact
else
rs("sendcontact")=0
end if
if checkdate<>"" then
rs("checkdate")=checkdate
else
rs("checkdate")=0
end if
rs("mycid")=mycid
rs("sendcid")=session("id")
rs("datetime")=now()
if saveSendMessage<>"" then 
rs("getprice1id")=rs1("id")
rs1.close
end if
rs.update
rs.close

if sendemail<>"" then
Dim mailbody
' 声明变量

	mailbody="<html>"
	mailbody=mailbody & "<head>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	mailbody=mailbody & username&"，您好：<br><br>"
	mailbody=mailbody & "你在" & webname & "上的好友给你留言了，请尽快查看！<br>"
	mailbody=mailbody & "地址是：" & weburl & "my/getprice/receivemessagelist.asp"
	mailbody=mailbody & "<br><br>"
	mailbody=mailbody&""&webname&" ◎ 客户服务中心<br>" 
    mailbody=mailbody&"================================================== <br>电话："&dh&"<br>"
    mailbody=mailbody&"Email："&webemail&"<a href="&weburl&" target=_blank>"&weburl&"</a> </body></html>" 

      topic="你好，你在"&webname&"网站上有人回复！" ' 信件主题
      mailbody=mailbody ' 信件内容
    Dim JMail
	on error resume next
	 Set jmail = Server.CreateObject("JMAIL.Message")   '建立发送邮件的对象
     jmail.silent = true    '屏蔽例外错误，返回FALSE跟TRUE两值j
     mail.logging = true   '启用邮件日志
     jmail.Charset = "GB2312"     '邮件的文字编码为国标
     jmail.ContentType = "text/html"    '邮件的格式为HTML格式
     jmail.AddRecipient Email     '邮件收件人的地址
     jmail.From = fmail   '发件人的E-MAIL地址
     jmail.MailServerUserName = umail     '登录邮件服务器所需的用户名
     jmail.MailServerPassword = pmail     '登录邮件服务器所需的密码
     jmail.Subject = Topic    '邮件的标题 
     jmail.Body = MailBody      '邮件的内容
     jmail.Prority = 1      '邮件的紧急程序，1 为最快，5 为最慢， 3 为默认值
     jmail.Send(smail)     '执行邮件发送（通过邮件服务器地址）
     jmail.Close()   '关闭对象
	Set JMail = Nothing
	end if
response.write"<SCRIPT language=JavaScript>alert('恭喜！新留言发送成功！');"
response.write"this.location.href='sendnewmessage.asp'</script>"
end if
%>
                  <SCRIPT language=JavaScript>
function changeFriend() {
    document.snsn.touser.value = document.snsn.friend.options[document.snsn.friend.selectedIndex].value;
}
                  </script>
</p>
                    <FORM name=snsn action="" method=post>
                      <br>
                      <TABLE width="90%" border=0 align="center" cellPadding=2 cellSpacing=1 bgcolor="#BBD7FF">
                        <COLGROUP>
                        <COL class=formtop>
                        </COLGROUP>
                        <TBODY>
                          <TR>
                            <TD 
                width="17%" align=right vAlign=top bgColor=#eff7ff class=C style="PADDING-TOP: 6px"><B>发送给：</B></TD>
                            <TD class=lh15 width="83%" bgColor=#FFFFFF><INPUT class="wenbenkuang" 
                  name=touser value="<%=secuser%>" size=15 maxlength="50">
                                <SELECT onChange="javascript: changeFriend()" 
                  size=1 name=friend>
                                  <OPTION class="wenbenkuang" value="" 
                    selected>从好友列表中选取</OPTION>
                                  <%sql2="select snsn_myfriend.friend_name,snsn_user.name from snsn_myfriend,snsn_user where snsn_myfriend.username='"&session("user")&"' and snsn_myfriend.relation<>-1 and snsn_user.username=snsn_myfriend.friend_name order by snsn_myfriend.id desc"		
					set rs2=conn.execute(sql2)
					if rs2.eof or rs2.bof then 
					response.write""
					else 
					do while not rs2.eof 
                    response.write"<OPTION value='"&rs2("friend_name")&"'>"&rs2("name")&"（"&rs2("friend_name")&"）</OPTION>"
					rs2.movenext
					loop
					end if
					rs2.close
					set rs2=nothing
					conn.close
                    set conn=nothing%>
                                </SELECT>
                                <SPAN 
                  class=note>（请填写对方的会员名或从伙伴中选取）</SPAN><%if session("id")=1 then%>
                                <input name="qf" type="checkbox" id="qf" value="qf" onClick="qf1()">群发
								<Script language=javascript>
								function qf1(){
								if(snsn.qf.checked){							
								snsn.touser.value="所有会员"							
								}else{								
								snsn.touser.value=""								
								}
								}					
								</script>
							<%end if%>
</TD>
                          </TR>
                          <TR>
                            <TD class=C bgColor=#eff7ff><div align="right"><B>附加码： </B></div></TD>
                            <TD bgColor=#FFFFFF><INPUT name=verifycode class="wenbenkuang" onKeyPress="return event.keyCode>=46&&event.keyCode<=57"  size=11 maxlength="4">
          请在附加码框中输入：<IMG src="../../conn/verifycode.asp?<%=timer()%>" height="15"></TD>
                          </TR>
                          <TR>
                            <TD class=C bgColor=#eff7ff><div align="right"><B>主题：</B></div></TD>
                            <TD bgColor=#FFFFFF><INPUT maxLength=50 size=50 name=messageTitle class="wenbenkuang">
                            </TD>
                          </TR>
                          <TR>
                            <TD class=C bgColor=#eff7ff>&nbsp;</TD>
                            <TD bgColor=#FFFFFF><input name="show" type="text"  id="show" size="40" maxlength="28" readOnly>
&nbsp; <a href="javascript:;" onClick="window.open('/web/qq/selqq.asp','web_show','scrollbars=no,resizable=no,width=370,height=365,menubar=no,top=188,left=188')" >魔法表情浏览...</a></TD>
                          </TR>
                          <TR bgColor=#ffffff>
                            <TD class=C bgColor=#eff7ff><div align="right"><B>主要内容：</B></div></TD>
                            <TD bgColor=#FFFFFF><TEXTAREA name=messageContent rows=10 cols=70 class="wenbenkuang"></TEXTAREA>
                            </TD>
                          </TR>
                          <TR bgColor=#ffffff>
                            <TD align="right" bgColor=#eff7ff class=C><strong>留言背景：</strong></TD>
                            <TD bgColor=#FFFFFF><table width="84%" height="71"  border="0" cellpadding="0" cellspacing="0">
                                <tr align="center">
                                  <td height="50">无图片</td>
                                  <td><img src="../images/pmskindef.gif" width="40" height="40"></td>
                                  <td><img src="../images/pmskin02.gif" width="40" height="40"></td>
                                  <td><img src="../images/pmskin03.gif" width="40" height="40"></td>
                                  <td><img src="../images/pmskin04.gif" width="40" height="40"></td>
                                  <td><img src="../images/pmskin05.gif" width="40" height="40"></td>
                                  <td><img src="../images/pmskin01.gif" width="40" height="40"></td>
                                </tr>
                                <tr align="center">
                                  <td><input name="bg" type="radio" checked></td>
                                  <td><input name="bg" type="radio" value="pmskindef.gif">
                                  </td>
                                  <td><input type="radio" name="bg" value="pmskin02.gif"></td>
                                  <td><input type="radio" name="bg" value="pmskin03.gif"></td>
                                  <td><input type="radio" name="bg" value="pmskin04.gif"></td>
                                  <td><input type="radio" name="bg" value="pmskin05.gif"></td>
                                  <td><input type="radio" name="bg" value="pmskin01.gif"></td>
                                </tr>
                            </table></TD>
                          </TR>
                          <TR bgColor=#ffffff>
                            <TD class=C bgColor=#eff7ff>&nbsp; </TD>
                            <TD bgColor=#FFFFFF><INPUT type=checkbox value=1
            name=sendEmail>
          发到对方的电子邮箱中<BR>
          <INPUT type=checkbox disabled CHECKED value=1 
            name=sendMessage>
          发到对方的“我收到的留言”中<BR>
          <input type=checkbox value=1 name=saveSendMessage>
          保存到我的“我发出的留言”中<BR>
          <INPUT 
            type=checkbox value=1 
        name=sendContact>
          发送我的联系方式<BR>
          <INPUT 
        name=checkdate 
            type=checkbox id="checkdate" value=1>
          是否要求近日做出答复<BR></TD>
                          </TR>
                        </TBODY>
                      </TABLE>
                      <BR>
                      <TABLE width=300 border=0 align="center" cellPadding=4 cellSpacing=0>
                        <TBODY>
                          <TR align=middle>
                            <TD noWrap><INPUT type=button value="发送" name=sendButton onClick="check()" class="go-wenbenkuang">
                            </TD>
                            <TD noWrap><INPUT type=reset value="重填" name=resetButton class="go-wenbenkuang">
                            </TD>
                          </TR>
                        </TBODY>
                      </TABLE>
                    </FORM>
                    <p>&nbsp;
                    </p></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
    <td valign="top"><img src="/img/index_img.jpg" width="10"></td>
  </tr>
</table>
<!--#include file="../../end.asp"-->
</body>
</html>
