I want to creat a script where I will allow user to reset their own password. I have tried different options but don't have any luck. Wonder what I want to do is kinda not valid or not.
ResetLogin.asp (where user will have to enter their username, old password, and new password).
[html]
<TR>
<TH ALIGN=LEFT> <FONT FACE="HELVETICA,HELV,ARIAL" SIZE=2> User Name: </FONT></TH>
<TD><INPUT CLASS="bluebox" NAME="Username" SIZE="25" TYPE="text" ID="Username"></TD>
</TR>
<TR>
<TH ALIGN=LEFT><FONT FACE="HELVETICA,HELV,ARIAL" SIZE=2> Old Password: </FONT></TH>
<TD><INPUT CLASS="bluebox" NAME="PassW" SIZE="25" TYPE="Password" ID="PassW"></TD>
</TR>
<TR>
<TH ALIGN=LEFT><FONT FACE="HELVETICA,HELV,ARIAL" SIZE=2> New Password: </FONT></TH>
<TD><INPUT CLASS="bluebox" NAME="NewPassW" SIZE="25" TYPE="Password" ID="NewPassW"></TD>
</TR>
<TR>
<TD ALIGN=CENTER COLSPAN=2> <INPUT CLASS="Table_Blue" TYPE="submit" NAME="Submit" VALUE="RESET/CHANGE PASSWORD"></TD>
</TR>[/html]
RCPassword.asp (this file will do the check of username, and password then update it. I am having problem to construct the portion to update the new password)
Expand|Select|Wrap|Line Numbers
- <%
- Dim Conn
- Dim RS
- Dim strSQl
- Dim strUsername
- Dim strPassW
- Dim strNewPassW
- strUsername = trim(Request.Form("Username"))
- strPassW = trim(Request.Form("PassW"))
- strNewPassW = trim(Request.Form("NewPassW"))
- If strUsername = "" OR _
- strPassW = "" OR _
- strNewPassW = "" Then
- Response.Redirect("UserLogin.asp?error=Sorry ... Username or Password does not exist. Please try again.")
- Else
- Set Conn = Server.CreateObject("ADODB.Connection")
- Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("PTSystem.mdb")
- strSQL = "Select * FROM Accounts where Username='" & strUsername & "' and PassW='" & strPassW & "'"
- RS.Open strSQL, Conn
- strSQL = "UPDATE Accounts SET NewPassW= '"& strPassW &"'"
- Conn.Execute(strSQL)
- Response.Write ("Thank You")
- End If
- RS.Close
- Set RS = Nothing
- Conn.Close
- Set Conn = Nothing
- %>