<%
Option Explicit
Dim sql, rsUser, username, oldpassword, newpassword, newpasswordconfirm, passwordlength, notfilled(4), calltype, icon
username = Request.Cookies("username")
'Assign form values to variables
oldpassword = Request.Form("oldpassword")
newpassword = Request.Form("newpassword")
newpasswordconfirm = Request.Form("newpasswordconfirm")
icon = Request.Form("icon")
'Ensure new password have been filled in
if newpassword = "" then
errorfunction("nonew")
end if
'Check password length is between 5 and 15 characters long
passwordLength = Len(newpassword)
if passwordLength < 5 or passwordLength > 15 then
errorfunction("length")
end if
'Check password and confirmed password are the same
if newpassword <> newpasswordconfirm then
errorfunction("confirm")
end if
'Open connection and insert user details into the database
%>
<%
Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.open "users WHERE username = '" & username & "'", conn, 3, 3
if rsUser("password") <> oldpassword then
errorfunction("wrongpwd")
else
rsUser("password") = newpassword
rsUser.Update
rsUser.close
set rsUser = nothing
conn.close
set conn = nothing
Response.Redirect("changepwd.asp?updated=true&icon=" & icon)
end if
%> <%Function errorfunction(calltype)%>
Your Profile
<%
if calltype = "nonew" then
Response.Write(" You have not entered a new password. ")
elseif calltype = "length" then
Response.Write("Your password must be between 5 and 15 characters long. ")
elseif calltype = "confirm" then
Response.Write("Your new password and confirmed password are not the same. ")
elseif calltype = "wrongpwd" then
Response.Write("You have entered an incorrect old password. ")
rsUser.close
set rsUser = nothing
conn.close
set conn = nothing
end if
%>
Lütfen Tekrar Deneyin
<%Response.end
End Function%> |
|
|
|