<!--#include file="sd_mdb.asp"-->
<!--#include file="sd_md5.asp"-->
<%
username=request.form("username")
userpass=request.form("password")
qq=request.form("userqq")
email=request.form("useremail")
verifycode=request.form("verifycode")

if cstr(session("getcode"))<>cstr(trim(verifycode)) then
	response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码！');history.go(-1);</script>"
	response.end
end if

if username="" or userpass="" or qq="" or email="" then
	Response.Write ("<script language=javascript>alert('注册信息填写不完整！');history.back(-1);</script>")
	Response.End
end if

set rs=server.createobject("adodb.recordset")
sql="select * from [sd_USER] where sd_USER='"&username&"'"
rs.open sql,conn,1,3
if not(rs.eof or rs.bof) then
	rs.close
	set rs=nothing
	Response.Write ("<script language=javascript>alert('此用户名已经被占用，请更换一个！');history.back(-1);</script>")
	response.end
else
	rs.addnew
	rs("sd_User")=username
	rs("sd_Pass")=md5(userpass)
	rs("sd_QQ")=qq
	rs("sd_email")=Email
	rs.update
	session("sd_username")=rs("sd_User")
	session("sd_password")=rs("sd_Pass")
	session("sd_userid")=rs("sd_UserID")
	session("sd_Points")=rs("sd_Points")
	rs.close
	set rs=nothing
	Response.Write ("<script language=javascript>this.location.href='sd_submit.asp';</script>")
	Response.End
end if
%>