<!-- #include file="include/config_other.asp" -->
<%
dim nsort,topic,url,err
err=""
nsort=trim(request.querystring("nsort"))
topic=trim(request.querystring("topic"))
url=trim(request.querystring("url"))
if len(nsort)<1 then err="yes"
if len(topic)<1 then err="yes"
if len(url)<1 then err="yes"
if err<>"" then
  if isobject(objv7) then set objv7=nothing
  response.write "<script language=javascript>alert(""您试图向本系统提交非法参数！"");window.close();</script>"
  response.end
end if
%>
<!-- #include file="include/conn.asp" -->
<!-- #include file="include/send_mail.asp" -->
<%
tit="推荐给好友"
call web_head(0,0,4,0,0)

if login_mode="" then
  call close_conn()
  if isobject(objv7) then set objv7=nothing
  response.write "<script language=javascript>alert(""您现在还没有登陆本站！\n\n请先注册并登陆本站。"");window.close();</script>"
  response.end
end if

if action="send" then
  call commend_send()
else
  call commend_main()
end if

call web_end2(0)

sub commend_send()
  dim fname,femail,remark,username,email,sbody,sendmail,weburl
  sendmail="ok"
  fname=trim(request.form("fname"))
  femail=trim(request.form("femail"))
  remark=request.form("remark")
  username=trim(request.form("username"))
  email=trim(request.form("email"))
  if fname="" or username="" or objv7.email_ok(femail)<>"yes" or objv7.email_ok(email)<>"yes" then
    response.write "<script language=javascript>alert(""系统发现您提交的数据有错误存在！\n\n请返回重新填定……"");history.back(1);</script>"
    exit sub
  end if
  weburl=objv7.web_var(web_config,2)
  if right(weburl,1)<>"/" then weburl=weburl&"/"
  sbody="注：本邮件为您的好友（"&username&"）推荐给你的信息！" & _
	vbcrlf&"--------------------------------------------------------" & _
	vbcrlf& _
	vbcrlf&"亲爱的"&fname&"，你好！" & _
	vbcrlf& _
	vbcrlf&"我最近在网上看一较好的地方，你可以看一下：" & _
	vbcrlf& _
	vbcrlf&objv7.web_var(web_config,1)&" - "&nsort & _
	vbcrlf&"相关标题："& topic & _
	vbcrlf&"相关地址："& weburl&url & _
	vbcrlf& _
	vbcrlf&"以下是您的好友给您的附言：" & _
	vbcrlf&"--------------------------------------------------------" & _
	vbcrlf&remark& _
	vbcrlf&"--------------------------------------------------------" & _
	vbcrlf& _
	vbcrlf&"你的朋友：" & username & _
	vbcrlf&"电子邮件：" & email & _
	vbcrlf&objv7.time_type(now_time,88)& _
	vbcrlf& _
	vbcrlf&"--------------------------------------------------------" & _
	vbcrlf&"更多精彩信息请访问：" & _
	vbcrlf& objv7.web_var(web_config,1) & _
	vbcrlf& weburl & _
	vbcrlf&"欢迎您的光临！"

  sendmail=send_jmail(femail,objv7.web_var(web_config,1)&" - 推荐给好友 - "&objv7.cuted(topic,10),sbody,username,email)
  'if sendmail="ok" then
    response.write "<script language=javascript>alert(""您已成功的为您好友（"&fname&"）推荐了一条信息！\n\n点击关闭……"");window.close();</script>"
  'else
  '  response.write "<script language=javascript>alert(""您在推荐给好友时出现了一些错误！\n\n请与管理员联系，谢谢！\n\n点击关闭……"");window.close();</script>"
  'end if
end sub

sub commend_main()
  dim email
  sql="select top 1 email from user_data where username='"&login_username&"'"
  set rs=conn.execute(sql)
  if not(rs.eof and rs.bof) then email=rs(0)
  rs.close:set rs=nothing
  response.write kong
%>
<table cellspacing=1 cellpadding=1 class=table>
<form action='?action=send&<%response.write "nsort="&server.urlencode(nsort)&"&topic="&server.urlencode(topic)&"&url="&server.urlencode(url)%>' method=post>
<tr><td class=td align=center colspan=2><b><%response.write tit%></b></td></tr>
<tr class=bg_2><td align=center width='20%'>推荐栏目：</td><td width='80%' class=blue><b><%response.write nsort%>&nbsp;</b></td></tr>
<tr class=bg_2><td align=center>推荐标题：</td><td class=red_3><%response.write topic%>&nbsp;</td></tr>
<tr class=bg_1><td align=center>好友姓名：</td><td><input type=text name=fname size=20 maxlength=20><%response.write redx%></td></tr>
<tr class=bg_1><td align=center>好友邮件：</td><td><input type=text name=femail size=50 maxlength=50><%response.write redx%></td></tr>
<tr class=bg_1><td align=center>推荐附言：</td><td><textarea name=remark rows=6 cols=50></textarea><%response.write redx%></td></tr>
<tr class=bg_2><td align=center>您的姓名：</td><td><input type=text name=username value='<%response.write login_username%>' size=20 maxlength=20><%response.write redx%></td></tr>
<tr class=bg_2><td align=center>您的邮件：</td><td><input type=text name=email value='<%response.write email%>' size=50 maxlength=50><%response.write redx%></td></tr>
<tr class=bg_1><td align=center>&nbsp;</td><td height=35>&nbsp;&nbsp;<input type=submit value='立即发送'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=reset value='重新填写'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%response.write closer%></td></tr>
</form>
</table>
<%
end sub
%>