usersave.asp页面
<!--#include file="conn.asp"-->
<%
dim nam,pwd,pwd1
nam=trim(request.Form("nam"))
pwd=trim(request.Form("pwd"))
pwd1=trim(request.Form("pwd1"))
If Request("action") = "usersave" Then
Call usersave(nam,pwd,pwd1)
End If
Sub usersave(nam,pwd,pwd1)
if nam="" then
response.Write"<script>alert('请输入用户名!');histroy.go(-1);</script>"
elseif pwd="" or pwd1="" then
response.Write"<script>alert('请输入密码!');history.go(-1);</script>"
elseif pwd<>pwd1 then
response.Write"<script>alert('两次输入的密码不一样!')history.go(-1);</script>"
elseif len(pwd)<6 or len(pwd1)<6 then
response.Write"<script>alert('密码不能少于6位')history.go(-1);</script>"
else
set rs=server.CreateObject("ADODB.Recordset")
rs.open "select * From student Where stuname='"&nam&"'",conn,3,3
if not(rs.eof and rs.bof) then
response.Write"<script>alert('该帐号已被注册')history.go(-1);</script>"
else
rs.addnew
rs("stuname")=nam
rs("pwd")=pwd
rs.update
response.Redirect("index.asp")
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
end sub
%>
[[it] 本帖最后由 hmhz 于 2008-11-30 13:44 编辑 [/it]]