well i tried but i can't sychronize them...
i dont know how to sychronize it pls help Thanks!
Code:
<% dim bcheck, ps, ps2 ps = request.form("ps")
ps2 = request.form("ps2")
ps3 = request.form("ps3") %> <% set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("Train.mdb"))
if Request.form("Staffpass")="" then
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "SELECT Staffpass FROM Login WHERE Staffid='" & session("userid2") &"'" ,conn
%>
<form method="post" action="psword.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><input type="hidden" value="<%=x.name%>"></td>
<td><input type="hidden" name="<%=x.name%>" value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
<table border="0">
<tr><td>New Password input type="password" name="ps"></td></tr>
<tr><td>Retype New Password : <input type="password" name="ps2"></td></tr>
<tr><td>Old Password : <input type="password" name="ps3"></td></tr>
</table>
<br /><br />
<input type="submit" value="Change Password" style="background-color: #dddddd; background-repeat: repeat; background-attachment: scroll; width: 100; height: 20; border: 2px solid black; background-position: 0% 50%; font-family: verdana; font-size: 9">
<br><br><font face="verdana" size="1"><a href="../test/staff.asp" STYLE='text-decoration: none'>Back</a></font>
</form>
<%
else
sql="UPDATE Login SET "
sql=sql & "Staffpass ='" & Request.Form("ps2") & "' "
sql=sql & " WHERE Staffid='" & session("userid2") &"'"
on error resume next
conn.Execute sql
set rs=Server.CreateObject("ADODB.Recordset")
if "SELECT * FROM Login WHERE Staffpass='" & request.form("ps3") &"'" then
if ps <> ps2 then
bcheck=false
response.write("<br><br><br><table border='1' width='500'><tr><td>")
response.write(" <center><br>Wrong Password! <br><br><b>Password</b> and <B>Retype Password</B> must be the same. <br><br>")
response.write("<font face='verdana' size='1'><a href='psword.asp' STYLE='text-decoration: none'>Back</a></font>")
response.write("<br><br></center></td></tr></table><br>")
'response.redirect("error.html")'
' the redirect means that when wrong password is type,'
'everything will stop here and go to another link.'
'Need to do this because for this kind of loop, when it detected error,'
'it will stop there and print out that error msg, so do a redirect to another'
'link is another way to check this kind of error.'
else
bcheck=true
if ps = ps2 then
response.write("<br>")
response.write("<br>")
response.write("<br><table border='1' width='500'><td>")
response.write("<center><font color='white'><br>Password Changed<br></font></center>")
response.write("<br><center><font face='verdana' size='1'><a href='login.asp' STYLE='text-decoration: none'>ReLogin</a></font>")
response.write("</center><br>")
response.write("</td></table>")
end if
end if
end if
end if
conn.close
%>