<%
'商易仿淘宝4.0(多用户)
'ACCESS版演示网站：http://www.ftaobao.com(商易仿淘宝商城)
'SQL版演示网站：http://sql.ftaobao.com
'电话：0571-56907100
'QQ：1147100
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>发送站内信---------------</title>
<link href="../include/css.css" rel="stylesheet" type="text/css">
</head>
<!--#include file="../include/conn.asp"-->
<!--#include file="../include/config.asp"-->
<!--#include file="inc.asp"-->
<%'禁止网页缓存及涮新
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = -1440 
Response.CacheControl = "no-cache"

if request("huiyuan")="" then
hy_close "对不起！参数错误，未找您要发送的会员名称！！！"
Response.end
end if

'会员判断
if Request.Cookies(Rikee)("huiyuan")<>"" then
set rs = conn.execute("select zt,vip from huiyuan where huiyuan='"&Request.Cookies(Rikee)("huiyuan")&"'")
if rs.eof then
Response.Cookies(Rikee)("huiyuan")=""
hy_close "您不是会员或尚未登陆，登陆后才能接发站内信！"
else
if rs(0)<>1 then
Response.Cookies(Rikee)("huiyuan")=""
hy_close "您不是会员或尚未登陆! 登陆后才能接发站内信！"
Response.end
else
'vip会员判断，并形成数值。
if rs(1)=0 then vip=2 else vip=1
end if
end if
rs.close
set rs=nothing
else
hy_close "您不是会员或尚未登陆，登陆后才能接发站内信！"
Response.end
end if
'发信
If request("fa")="yes" Then
if shopnet("huiyuan")="" or shopnet("bt")="" or shopnet("nr")="" then
hy_close "对不起,接收会员、标题、内容均不能为空!"
Response.end
end if
if request("huiyuan")=Request.Cookies(Rikee)("huiyuan") then
hy_close "对不起！您不能自己给自己发出站内信！！！"
Response.end
end if
set rs=conn.execute("select huiyuan from huiyuan where huiyuan='"&shopnet("huiyuan")&"'")
if rs.eof then
hy_close "对不起！您不能成功地发出站内信，在数据库中未能找到与之匹配的接收会员名称！"
response.end
end if

if datediff("s",cdate(Request.Cookies(Rikee)("dx_sj")),now())<clng(chat_sj)*vip then
hy_close "对不起！本系统为了防止灌水，限制了同一人发站内信的时间间隔。\n普通会员为 "&clng(chat_sj)*2&" 秒，VIP会员为 "&clng(chat_sj)*1&" 秒！"
response.end
end if
conn.execute("Insert into duanxin(bt,nr,name1,name2,lx)values('"&shopnet("bt")&"','"&shopnet("nr")&"','"&shopnet("huiyuan")&"','"&Request.Cookies(Rikee)("huiyuan")&"',1)")
Response.Cookies(Rikee)("dx_sj")=now()
Response.Write "<br>&nbsp;&nbsp;&nbsp;&nbsp;·<font color=red>恭喜您，您填写的站内信已成功的发送！！</font><br><br>&nbsp;&nbsp;&nbsp;&nbsp;·窗口正在1秒钟内自动关闭中......"
Response.Write "<body onload=closewin() topmargin=1 leftmargin=1>" 
fa_close 1000
else
if request("y_id")<>"" then
set rs = conn.execute("select bt,nr from duanxin where id="&shopnet("y_id")&" and name1='"&Request.Cookies(Rikee)("huiyuan")&"'")
if not rs.eof then
bt="Re:"&rs(0)
nr=rs(1)&chr(10)&"===================================="&chr(10)
end if
rs.close:set rs=nothing
end if%>
<base target="_top">
<script language="javascript">
function add(aa){		 
if((aa.huiyuan.value=='')||(aa.bt.value=='')||(aa.nr.value=='')){			
alert("对不起,站内信接收会员、标题、内容均不能为空!");
return false;}
if(aa.nr.value.length>255){			
alert("对不起,每条站内信内容不能超过255字!");
return false;}}
function emoticon(theSmilie){
document.chat.nr.value +=theSmilie + '';
document.chat.nr.focus();}
</script>
<body bgcolor="#F3F3F3">
<div align="center">
  <table border="0" cellpadding="0" cellspacing="0" width="100%" id="table1">
    <form method="POST" action="?fa=yes" name="chat" onSubmit="javascript:return add(this)">
      <tr> 
        <td height="30" valign="middle">&nbsp;发送给： 
          <input name="huiyuan" type="text" class="wenbenkuang" id="huiyuan" value="<%=request("huiyuan")%>" size="18" maxlength="16"></td>
      </tr>
      <tr>
        <td height="30" valign="middle">&nbsp;站内信标题： 
          <input name="bt" type="text" class="wenbenkuang" id="bt" value="<%=bt%>" size="53" maxlength="25">
        </td>
      </tr>

      <tr> 
        <td valign="top"> 
          <textarea name="nr" cols="66" rows="7" class="wenbenkuang"><%=nr%></textarea>
        </td>
      </tr>
      <tr> 
        <td height="30" align="center" valign="middle"> 
          <input name="B1" type="submit" class="go-wenbenkuang" value="提交"> 
          <input name="B1" type="reset" class="go-wenbenkuang" value="重写"> 
          <input name="B1" type="button" class="go-wenbenkuang" value="关闭窗口"onClick="javascript:self.close();">
        </td>
      </tr>
    </form>
  </table>
</div>
</body>
</html>
<%end if
conn.close:set conn=nothing
%>
