<!--#include file="md5.asp"-->
<!--#include file="conn1.asp"-->
<%
'进行安全性监测，看数据来源是否是本服务器页面
if not instr(1,Request.ServerVariables("http_Referer"),Request.ServerVariables ("SERVER_NAME"),1)=8 then
response.write"<SCRIPT language=JavaScript>alert('请不要从本服务器页面提交信息!');"
response.write"javascript:self.close()</SCRIPT>"
response.end
end if
%>
<%
'++++++++++++接受数据开始+++++++++++
uid=trim(request.form("uid"))
pwd=md5(trim(request.form("pwd")))
username=trim(request.form("UserName"))
cid=trim(request.form("cid"))
tel=trim(request.form("tel"))
email=trim(request.form("email"))
qq=trim(request.form("qq"))
ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
If ip = "" Then 
ip = Request.ServerVariables("REMOTE_ADDR") 
end if
zcdate=Now()

'++++++++++++接受数据结束+++++++++++

'++++++++++++写入数据库开始+++++++++++
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from nyeee_user where uid= '"&uid&"'"
rs.open sql,conn,1,1
if rs.eof or rs.bof then
conn.execute "insert into user(uid,pwd,username,cid,tel,email,qq,ip,zcdate) values ('"&uid&"','"&pwd&"','"&username&"','"&cid&"','"&tel&"','"&email&"','"&qq&"','"&ip&"','"&zcdate&"')"
'++++++++++++写入数据库结束+++++++++++
'给SESSION,导入首页
session("nyeee_uid")=uid
response.write"<script>alert('注册成功！');location='user.asp'</script>"
rs.close
set rs=nothing
else

rs.close
set rs=nothing
response.write"<SCRIPT language=JavaScript>alert('对不起，此用户名已经存在');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
%>