<!-- #include file="include/skin.asp" -->
<!-- #include file="include/jk_email.asp" -->
<!-- #include file="include/jk_sendmail.asp" -->
<!-- #include file="include/jk_val_code.asp" -->
<%

dim nsort,topic,url
nsort=trim(request.querystring("nsort"))
topic=trim(request.querystring("topic"))
url=trim(request.querystring("url"))
topic=joekoe_cms.code_html(topic,1,0)
if var_null(nsort)="" or var_null(topic)="" or var_null(url)="" then
  response.write "<script language=javascript>alert(""您试图向本系统提交非法参数！\n\n不过好像没有那么容易啊！\n\n真不好意思……"");window.close();</script>"
  call web_clears(1)
end if

tit="推荐给好友"
call web_head(0,0,4,0,0)

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

call web_copy()
call web_end(0,1)

sub commend_send()
  dim found_err,fname,femail,remark,username,email,sbody,sendmail
  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"))
  found_err=""
  if val_chk("commend")=false then
    response.write "<script language=javascript>alert(""系统发现您提交的数据有错误存在：\n\n您提交的 验证码 有错误，请勿非法提交！\n\n请返回重新填定……"");history.back(1);</script>"
    exit sub
  end if
  'email_ok(email,en)
  if fname="" or username="" or email_ok(femail,50)=false or email_ok(email,50)=false then
    response.write "<script language=javascript>alert(""系统发现您提交的数据有错误存在：\n\n好友姓名、好友邮件、推荐附言以及您的姓名和邮件不能为空！\n\n请返回重新填定……"");history.back(1);</script>"
    exit sub
  end if
  
  sbody="我最近在网上看一较好的网页内容，你可以看一下：" & _
	vbcrlf& _
	vbcrlf& topic & _
	vbcrlf&"相关地址："& joekoe_cms.web_urls&url & _
	vbcrlf&"相关主题："& joekoe_cms.web_name&" - "& nsort & _
	vbcrlf& _
	vbcrlf&"以下是您的好友给您的附言：" & _
	vbcrlf&"--------------------------------------------------------" & _
	vbcrlf&remark& _
	vbcrlf&"--------------------------------------------------------" & _
	vbcrlf& _
	vbcrlf&"你的朋友：" & username & _
	vbcrlf&"电子邮件：" & email
  sendmail=send_mail(fname,femail,tit,sbody)
  if sendmail 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
  call val_chk_end("commend")
end sub

sub commend_main()
  dim email
  sql="select top 1 email from user_data where username='"&login_username&"'"
  set rs=joekoe_cms.exec(sql,1)
  if not rs.eof then email=rs(0)
  rs.close
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td0 colspan=2>&nbsp;<%response.write img_skin("m_")&tit%></td></tr>
<form action='?<%response.write "nsort="&server.urlencode(nsort)&"&topic="&server.urlencode(topic)&"&url="&server.urlencode(url)%>' method=post onsubmit="javascript:frm_submitonce(this);">
<input type=hidden name=chk value='yes'>
<%response.write val_code_num("commend",1)%>
<tr class=bg_td><td width='20%'>推荐栏目：</td><td width='80%' class=blue><b><%response.write nsort%>&nbsp;</b></td></tr>
<tr class=bg_td><td>推荐标题：</td><td class=red_3><%response.write topic%>&nbsp;</td></tr>
<tr class=bg_tds><td>好友姓名：</td><td><input type=text name=fname size=20 maxlength=20><%response.write redx%></td></tr>
<tr class=bg_tds><td>好友邮件：</td><td><input type=text name=femail size=40 maxlength=50><%response.write redx%></td></tr>
<tr class=bg_tds><td>推荐附言：</td><td><textarea name=remark rows=7 cols=55></textarea><%response.write redx%></td></tr>
<tr class=bg_td><td>您的姓名：</td><td><input type=text name=username value='<%response.write login_username%>' size=20 maxlength=20><%response.write redx%></td></tr>
<tr class=bg_td><td>您的邮件：</td><td><input type=text name=email value='<%response.write email%>' size=40 maxlength=50><%response.write redx%></td></tr>
<tr class=bg_tds><td colspan=2 align=center height=40><input type=submit value='立即发送推荐邮件'>　　　<input type=reset value='重新填写'></td></tr>
</form>
</table>
<%
end sub
%>