%
ErrorText=""
Username = ""
Password = ""
Password2 = ""
Email = ""
If Request.Form("action") = "Register" Then
Username = Request.Form("username")
Password = Request.Form("password")
Password2 = Request.Form("password2")
Email = Request.Form("email")
'Validate fields
if Len(Username)=0 Then
ErrorText = ErrorText & "You must specify a username.
"
End If
if Len(Username)<5 Then
ErrorText = ErrorText & "Username must be as least 5 characters long.
"
End If
if Username=Password Then
ErrorText = ErrorText & "Username and password must differ.
"
End If
if Len(Password)=0 Then
ErrorText = ErrorText & "You must specify a password.
"
End If
if Len(Password)<6 Then
ErrorText = ErrorText & "The password must be as least 6 characters long.
"
End If
SQL = "select count(*) from user where username = '" & SqlEsc(Username) & "'"
Set RS = Conn.Execute(SQL)
If rs(0) > 0 Then
ErrorText = ErrorText & "Username is already taken.
"
End If
SQL = "select count(*) from user where email = '" & SqlEsc(Email) & "'"
Set RS = Conn.Execute(SQL)
If rs(0) > 0 Then
ErrorText = ErrorText & "An account has already been created using that email adress. If you have forgotten your username or password, please click here.
"
End If
If Password <> Password2 Then
ErrorText = ErrorText & "The password and the repeated password differs.
"
End IF
If not validateEmail(email) Then
ErrorText = ErrorText & "The email address is not valid.
"
End If
If ErrorText = "" Then 'If all is OK, create the user
RegistrationCode = ""
Randomize(Cbyte(Left(Right(Time(),5),2)))
For i = 1 to 30
RegistrationCode = RegistrationCode & chr(int(rnd*25)+65)
Next
SQL = "INSERT INTO user (username, password, email, disabled, registrationkey, registered_on) VALUES ('" & SqlEsc(Username) & "', '" & SqlEsc(Password) & "', '" & SqlEsc(Email) & "', '2', '" & SqlEsc(RegistrationCode) & "', Sysdate())"
Conn.Execute(SQL)
Call SendRegistrationMail(Email, Username, RegistrationCode)
Call LogIt("register_account.asp", "", "", Username, Email, "", "", "")
ErrorText = "ClickLink"
End If
End If
%>
| Register <% =ErrorText %> Once you have registered, an email will be sent to the specified adress. You need to click the link within the email to activate your account. |
| Register Please check your email and click the link you find there. |