Hello all,
I am trying to add a function in my website to allow users to change their passwords after they have logged in.
I have tested my code and I get to the success page but my table doesn't get updated with the new password. here is the code from my update_password ASP page:
<!-- #include file="adovbs.inc" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Update Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
'Setup the strings for the old and new passwords and the Username
strOldPass = Request.Form("OldPassword"
strNewPass = Request.Form("NewPassword"
strUser = Session("User"
SQL = "UPDATE Users SET UserPassword ='" & strNewPass & "' WHERE Username ='" & strUser & "'"
SQL2 = "SELECT UserPassword FROM Users WHERE Username = '" & strUser & "'"
set adoConn = Server.CreateObject ("ADODB.Connection"
'set adoRS = Server.CreateObject ("ADODB.RecordSet"
adoConn.Open "DSN=LocalServer; UID=Standard;PWD=password"
adoConn.Execute(SQL)
'adoRS.Open SQL2,adoConn
'If Trim(strNewPass) = Trim(adoRS("UserPassword"
) Then
Response.Redirect("update_success.asp"
'Else
'Response.Redirect("update_fail.htm"
'End If
'set adoRS = Nothing
set adoConn = Nothing
%>
</body>
</html>
Any help is greatly appreciated!
Cheers,
Curtis
I am trying to add a function in my website to allow users to change their passwords after they have logged in.
I have tested my code and I get to the success page but my table doesn't get updated with the new password. here is the code from my update_password ASP page:
<!-- #include file="adovbs.inc" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Update Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
'Setup the strings for the old and new passwords and the Username
strOldPass = Request.Form("OldPassword"
strNewPass = Request.Form("NewPassword"
strUser = Session("User"
SQL = "UPDATE Users SET UserPassword ='" & strNewPass & "' WHERE Username ='" & strUser & "'"
SQL2 = "SELECT UserPassword FROM Users WHERE Username = '" & strUser & "'"
set adoConn = Server.CreateObject ("ADODB.Connection"
'set adoRS = Server.CreateObject ("ADODB.RecordSet"
adoConn.Open "DSN=LocalServer; UID=Standard;PWD=password"
adoConn.Execute(SQL)
'adoRS.Open SQL2,adoConn
'If Trim(strNewPass) = Trim(adoRS("UserPassword"
Response.Redirect("update_success.asp"
'Else
'Response.Redirect("update_fail.htm"
'End If
'set adoRS = Nothing
set adoConn = Nothing
%>
</body>
</html>
Any help is greatly appreciated!
Cheers,
Curtis