%
Option Explicit
Dim strError, strSQL
'see if the form has been submitted
If Request.Form("action")="register" Then
If Request.Form("email") = "" Then strError = strError & "- Please enter a email
" & vbNewLine
If Request.Form("password") = "" Then strError = strError & "- Please enter a password
" & vbNewLine
If Request.Form("name") = "" Then strError = strError & "- Please enter a name
" & vbNewLine
If Request.Form("password") <> Request.Form("password_confirm") And Request.Form("password") <> "" Then _
strError = strError & "- Your passwords do not match
" & vbNewLine
'// check if an error has occured
If strError = "" Then 'continue, include database connection code
%> <%
On Error Resume Next
Dim str1, str2, str3, datestrs
str1 = month(date)
str2 = day(date)
str3 = year(date)
datestrs = str3 & "-" & str1 & "-" & str2
strSQL = "INSERT INTO tblMembers (email,name,password,regDate) VALUES " & _
"('" & fixQuotes(Request.Form("email")) & "','" & _
fixQuotes(Request.Form("name")) & "','" & _
fixQuotes(Request.Form("password")) & "','1900-01-01')"
objConn.Execute strSQL
If Err.Number = -2147217900 Then
strError = "- That email is already in use. Please choose another.
" & vbNewLine
ElseIf Err.Number <> 0 Then
strError = "- An error occured. " & Err.Number & " : " & Err.Description & "
" & vbNewLine
Else
'record created... automatically log user in, redirect to subscribe
Response.Redirect "login.asp?msg=You+have+successfully+registered!"
Response.End
End If
'restore standard error handling
On Error Goto 0
End If
If strError <> "" Then
'output the error message
strError = "
The following errors occured:" & "
" & vbNewLine & strError
End If
End If
Function fixQuotes(strData)
fixQuotes = Replace(strData,"'","''")
End Function
%>
![]() |
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|