<!-- #Include file="ADOVBS.INC" --> <% name=request.form("T1") email=request.form("T4") pass=request.form("T2") pass2=request.form("T3") error="" if email="" then error=error+"必须填写邮件<br>" end if if name="" then error=error+"必须填写用户名<br>" end if if not pass=pass2 then error=error+"两次密码必须相同<br>" end if if pass="" then error=error+"必须填写密码<br>" end if
'find if user exist Set conn=Server.CreateObject("ADODB.Connection") conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=F:/ONE/liaotian/db1.mdb;" Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from [user] where name='" & name & "'", conn, adOpenStatic, adLockReadOnly, adCmdText
if rs.recordcount>0 then error=error+"User already existed<br>" end if '没有错误添加到数据库 if error="" then conn.execute "insert into [user] (name,email,password) values ('" & name & "','" & email & "','" & pass & "')" %> <link href="coffeeStore.css" rel="stylesheet" type="text/css">
恭喜您已经注册成功,请点击<a href="user_1.asp">登陆</a>。 <%else%>
<%=error%>
<% end if rs.close conn.Close %>
[此贴子已经被作者于2004-11-07 15:04:04编辑过]