%
ErrorText=""
OldPassword = ""
Password = ""
Password2 = ""
Email = ""
If Request.Form("action") = "changepassword" Then
OldPassword = Request.Form("oldpassword")
Password = Request.Form("password")
Password2 = Request.Form("password2")
SQL = "select count(*) from user WHERE username = '" & SqlEsc(Session("username")) & "' and password = '" & SqlEsc(OldPassword)& "';"
Set RS = Conn.Execute(SQL)
If rs(0) = 0 Then
ErrorText = ErrorText & "Old password incorrect.
"
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
if Session("username")=Password Then
ErrorText = ErrorText & "Username and password must differ.
"
End If
If Password <> Password2 Then
ErrorText = ErrorText & "The password and the repeated password differs.
"
End IF
If ErrorText = "" Then 'If all is OK, change the password
SQL = "UPDATE user SET password ='" &SqlEsc(Password) & "' WHERE username = '" & SqlEsc(Session("username")) & "' and password = '" & SqlEsc(OldPassword)& "';"
Conn.Execute(SQL)
Call LogIt("change_profile.asp", "", "", "Password changed", "", "", "", "")
ErrorText = "Password changed"
End If
End If
If Request.Form("action") = "changeemail" Then
Email = Request.Form("email")
SQL = "select count(*) from user where email = '" & SqlEsc(Email) & "'"
Set RS = Conn.Execute(SQL)
If rs(0) > 0 Then
ErrorText = ErrorText & "Another account is using that email adress.
"
End If
If not validateEmail(email) Then
ErrorText = ErrorText & "The email address is not valid.
"
End If
If ErrorText = "" Then 'If all is OK, change the emailaddy, set the account disabled and send a registrationmail
RegistrationCode = ""
Randomize(Cbyte(Left(Right(Time(),5),2)))
For i = 1 to 30
RegistrationCode = RegistrationCode & chr(int(rnd*25)+65)
Next
SQL = "UPDATE user SET email = '" & sqlesc(Email) & "', disabled=2, registrationkey = '" & SqlEsc(RegistrationCode) & "' where username = '" & SqlEsc(Session("username")) & "';"
Conn.Execute(SQL)
Call SendRegistrationMail(Email, Session("username"), RegistrationCode)
Call LogIt("change_profile.asp", "", "", "Email changed", "", "", "", "")
ErrorText = "ClickLink"
End If
End If
If Len(Request.Form("action")) = 0 Then
SQL = "select email from user where username='" & SqlEsc(Session("username")) & "';"
Set RS = Conn.Execute(SQL)
If not RS.EOF Then
Email=RS("email")
End If
End If
%>
| Edit profile information |
| Re-Confirm email address Please check your email and click the link you find there. |