This article provides a user-registered instance for aspaccess. The page only provides some reference code. We provide the complete source code for this instance to download. If you like, you can download the source code for free. This article provides an access user registration instance for the asp tutorial. The page only provides some reference code. We provide a complete set of instances.
This article provides an example for asp access user registration. The page only provides some reference code. We provide the complete source code for this instance. If you like, you can download the source code for free. This article provides an access user registration instance for the asp tutorial. The page only provides some reference code. We provide a complete set of instances.
This article providesUserRegisterInstanceOh, the page only provides some reference code. We provide thisInstanceDownload the complete source code. If you like, you can download the source code for free.
This article providesAsp tutorial accessUserRegisterInstanceOh, the page only provides some reference code. We provide thisInstanceDownload the complete source code. If you like, you can download the source code for free.
<%
Sub save ()
Dim username, userpwd, pwd, name, email
'Read from the form passedUserName Data. The trim function removes leading and trailing spaces from the string.
Username = trim (request. form ("username "))
Userpwd = trim (request. form ("userpwd "))
Pwd = trim (request. form ("pwd "))
Name = trim (request. form ("name "))
Email = trim (request. form ("email "))
'UserIncomplete Input
If username = "" or userpwd = "" or pwd = "" or name = "" or email = "" then
'Give a prompt and returnRegisterPage. History. back () indicates thatRegisterPage
Response. write "script alert ('the input information is incomplete! '); History. back (); script"
Response. end
End if
If userpwd <> pwd then', the two passwords are different.
'Give a prompt and returnRegisterPage
Response. write "script" alert ('the passwords entered twice are different! '); History. back (); script"
Response. end
End if
'Isvalidemail process judgmentUserThe entered email address is in the correct format.
If not isvalidemail (email) then
'If the email address format is incorrect, a prompt is displayed and a message is returnedRegisterPage
Response. write "script alert ('email address format is incorrect! '); History. back (); script"
Response. end
End if
'Determine whether the database exists in the tutorialUserInputUserName
Set hvrs = server. createobject ("adodb. recordset ")
'Query records with username column values in the database
SQL = "select * from user where username = '" & username &"'"
Hvrs. open SQL, conn, 1, 1
If not (hvrs. eof and hvrs. bof) then 'has records that meet the conditions.
'UserIf the name exists in the database, a prompt is displayed and a response is returned.RegisterPage
Response. write "script" alert ('ThisUserThe specified name already exists! Please enter another ...... '); History. back (); script"
Response. end
Else 'does not have a record that meets the condition
'Insert a new record into the database
Set rs = server. createobject ("adodb. recordset ")
SQL = "select username, password, name, email from user"
Rs. open SQL, conn, 1, 3
Rs. addnew
Rs ("username") = username'UserLogin Name
Rs ("password") = md5 (userpwd )'UserLogon Password
Rs ("name") = name'UserReal name
Rs ("email") = email'UserEmail
Rs. Update' update database
Rs. close
End if
Hvrs. close
Set hvrs = nothing
End sub
%>
Chat Room
Chat RoomRegisterWizard
<%
If request. querystring ("result") = "successful" then
Call save ()
Call show ()
Else
Call main ()
End if
%>
<% Sub main () %>
<% End sub %>
<% Sub show () %>
UserRegisterSuccessful
|
Your information settings have been successfully set. Please click "finish" to enter the chat room"
[Complete]
|
<% End sub %>
<%
Set rs = nothing
Conn. close
Set conn = nothing
%>
Download this sectionInstanceSource code
Http://down.111cn.net/down/code/asp/2010/1024/21402.html