<%
dim action
uname=trim(request("login_name"))
upsw=md5(trim(request("password")),16)
cname=trim(request("nick"))
uemail=trim(request("email"))
usex=trim(request("sex"))
action=request("action")
if action="serchname" then
login_name=trim(request("login_name"))
set rs=server.CreateObject("ADODB.RECORDSET")
sql="select user_name from f_user where user_name='"&login_name&"'"
rs.open sql,conn,1,1
if not rs.eof then
response.Write("<script>alert(""此用户名已经存在,请重新输入!"");window.close();</script>")
else
response.Write("<script>alert(""此用户名可以注册!"");window.close();</script>")
rs.close
set rs=nothing
end if
end
if
dim tName,tEmail,tCuname
tName=0
tEmail=0
tCuname=0
if action="add" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select user_name from f_user where user_name='"&trim(request("login_name"))&"' ",conn,1,1
tName=rs.eof
rs.close
rs.open "select user_email from f_user where user_email='"&trim(request("email"))&"' ",conn,1,1
tEmail=rs.eof
rs.close
rs.open "select cuname from f_user where cuname='"&trim(request("nick"))&"' ",conn,1,1
tCuname=rs.eof
rs.close
set rs=nothing
if Not tName then
response.write "<script LANGUAGE='javascript'>alert('对不起,您的用户名已经有人使用!请重新选择!');window.close();</script>"
elseif Not tEmail then
response.write "<script LANGUAGE='javascript'>alert('对不起,您的Email已经有人使用!请重新选择!');window.close();</script>"
elseif Not tCuname then
response.write "<script LANGUAGE='javascript'>alert('对不起,您的昵称已经有人使用!请重新选择!');window.close();</script>"
else
set rs=server.CreateObject("adodb.recordset")
rs.open"select * from f_user",conn,1,3
rs.addnew
rs("f_sf")=request("shafa")
rs("user_name")=uname
rs("passwd")=upsw
rs("cuname")=cname
rs("user_email")=uemail
rs("user_sex")=usex
rs("find_sex")=trim(request("find_sex"))
rs("province")=trim(request("Province"))
rs("city")=trim(request("City"))
rs("lianxi")=0
rs("jifen")=50
rs("reg_date")=date()
rs("last_login")=now()
rs("uip")=Request.ServerVariables("REMOTE_ADDR")
rs.update
rs.close
set rs=nothing
response.Cookies("f_user_name")=trim(request("login_name"))
set rs=server.CreateObject("adodb.recordset")
rs.open "select user_id,user_name,cuname from f_user where user_name='"&request.Cookies("f_user_name")&"'",conn,1,1
user_id1=rs("user_id")
user_name1=rs("user_name")
cuname1=rs("cuname")
rs.close
set rs=nothing
set rs1=server.CreateObject("adodb.recordset")
rs1.open"select * from dv_user",conn,1,3
rs1.addnew
rs1("UserName")=cname
rs1("UserPassword")=upsw
rs1("UserEmail")=uemail
if usex="男性" then
rs1("UserSex")=1
else
rs1("UserSex")=0
end if
rs1("UserFace")="images/userface/image1.gif"
rs1("UserIM")="||||||||||||||||||"
rs1("UserClass")="新手上路"
rs1.update
rs1.close
set rs1=nothing
dim conn1
dim connstr1
dim db1
db1="diary/db/data.mdb"
'改成你的数据库地址
On Error Resume Next
Set conn1= Server.CreateObject("ADODB.Connection")
connstr1="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db1&"")
conn1.Open connstr1
If Err Then
err.Clear
Set Conn1 = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
set rsu=server.CreateObject("adodb.recordset")
rsu.open"select * from diaryuser",conn1,1,3
rsu.addnew
rsu("user_id")=user_id1
rsu("username")=user_name1
rsu("cuname")=cuname1
rsu("password")=request("password")
rsu("sex")=request("sex")
rsu.update
rsu.close
set rsu=nothing
Dim SendMail,topic,mailbody
Dim getpass
dim useremail
useremail=trim(request("email"))
topic="沙发客欢迎您!"
getpass=trim(request("password"))
%>
<!--#include file="email_txt.asp"-->
<%
call jmail(useremail,topic,mailbody)
response.Write "<script language=javascript>alert('注册成功!请进一步完善您的个人资料!');location.href='register2.asp'</script>"
end if
end if
%>