register.asp
来自「《SQL Server 2000课程设计案例精编》-李昆-源代码-3436」· ASP 代码 · 共 64 行
ASP
64 行
<!--#include file="Include/ADOdata.asp" -->
<%
Dim strUserName 'As String
Dim strPassword 'As String
Dim strUserID ' As String
Dim objSecurity 'As Awsome.Security
'清除现存cookie
Response.Cookies("userauthid")= ""
'捕获输入资料
strUserName = Request.Form("txtUserName")
strPassword = Request.Form("txtPassword")
'检查密码是否一致
If strPassword <> Request.Form("txtPassword2") Then
Response.Write "密码不一致."
Server.transfer "Register.htm"
End If
'呼叫Adduser
strUserID = AddUser(strUserName, strPassword)
If strUserID= "invalid" Then
Response.Write "<H2>登录确认错误</H2>"
Response.Write "请再试一次."
Server.transfer "Register.htm"
Else
Response.Cookies("userauthid")= strUserID
server.execute "main.asp"
End If
Function AddUser(strUserName, strPassword)
'新增会员
Dim cmd
Dim strUserID
Dim conDB
strUserID = "invalid"
'检查输入资料格式正确性,然后执行adduser stored procedure
If ValidData(strUserName, strPassword) Then
Set cmd = CreateObject("ADODB.Command")
With cmd
.ActiveConnection = strCon
.CommandText = "adduser"
.CommandType = adCmdStoredProc
.Parameters(1).Value = strUserName
.Parameters(2).Value = strPassword
.Execute
End With
'检查返回的user id
If Not IsNull(cmd.Parameters(3).Value) Then
strUserID = cmd.Parameters(3).Value
End If
End If
AddUser = strUserID
Set cmd = Nothing
set conDB = nothing
End Function
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?