<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/safe.asp"-->
<%
dim errmsg
errmsg=""

dim username,sex,birthday,email,provence,city,hdid
dim school,vocation,marry,cell,phone,renshu,hyid

username=trim(ReplaceBadChar(request.Form("uname")))
sex=request.Form("sex")
birthday=request.Form("birthday")
email=trim(ReplaceBadChar(request.Form("email")))
provence=request.Form("sheng")
city=request.Form("shi")
school=request.Form("school")
vocation=request.Form("zhiye")
marry=request.Form("marry")
cell=trim(ReplaceBadChar(request.Form("cell")))
phone=trim(ReplaceBadChar(request.Form("phone")))
renshu=request.Form("renshu")
hyid=request.Form("hyid")
hdid=request.Form("hdid")

if not isnumeric(renshu) then renshu=1

'on error resume next
set rs=server.CreateObject("adodb.recordset")
sql="select * from jyhd_baoming where uname='"& username &"' and hdid="& hdid &""
rs.open sql,conn,1
if not(rs.eof or rs.bof) then
  errmsg=errmsg+"<li><strong><font size=4>该帐号已经报名，请不要重复提交报名信息！</font></strong>"
end if 
rs.close
set rs=nothing

if username="" then errmsg=errmsg+"<br>"+"<li>您的帐号不能为空！"
if checkshit(username) then  errmsg=errmsg+"<br>"+"<li>帐号可能含不文明词语，请检查！"
if checkforbidword(username) then  errmsg=errmsg+"<br>"+"<li>帐号可能含系统禁止使用词语(如管理员等)，请检查！"
if not isdate(birthday) then errmsg=errmsg+"<br>"+"<li>您的出生日期格式不正确！"
if provence="" or city="" then errmsg=errmsg+"<br>"+"<li>请选择您的籍贯和所在城市！"

if errmsg<>"" then 
response.Write "错误信息：<br>"
response.write("　　　"+ errmsg)
response.Write "<input type='button' value='返回修改' onClick='javascript:window.history.back(-1);'>"
response.Write "<input type='button' value='关闭窗口' onClick='javascript:window.close();'>"
response.end
end if

set rst=server.CreateObject("adodb.recordset")   '添加交友帐号
sql1="select * from jyhd_baoming"
rst.open sql1,conn,1,3
rst.addnew
if hyid<>"" then
  rst("ishy")=1
  rst("userid")=hyid
else
  rst("ishy")=0
end if
rst("hdid")=hdid
rst("uname")=username
rst("sex")=sex
rst("birthday")=birthday
rst("sheng")=provence
rst("shi")=city
rst("email")=email
rst("school")=school
rst("vocation")=vocation
rst("marry")=marry
rst("cell")=cell
rst("tel")=phone
rst("dtime")=now()
rst("pnum")=renshu
rst.update
rst.close
set rst=nothing

conn.close
set conn=nothing
response.Write "<script language='javascript'>alert('您的报名信息已经成功提交！');window.location='huodong.asp?hdid="& hdid &"'</script>"
response.end
%>