Hey,
Below is the PHP code for a password changing form. Now it was working I believe, however it has now stopped working. Anyway here is the PHP code see if you can spot anything wrong that I cannot.
<?php
if ($formsubmit!="") { $formsubmit="";
include("data.inc.php");
$report = "";
mysql_connect ($SQLhost, $SQLuser, $SQLpass);
mysql_select_db ($SQLdb);
$res_access = mysql_query ("SELECT id, userid, password FROM users where userid='$id'");
$num_access = mysql_num_rows ($res_access);
if ($num_access==0)
{ $report = "Your ID could not be found."; }
else
{
$db_password = mysql_result ($res_access,0,"password");
if ($db_password!=$pass_old)
{
$report = "The password that you have entered does not match the record in our database.";
}else{
if ($pass_new != $pass_new2) {
$report = "The new passwords you have entered do not match.";
}else{
$report = "Your password has been altered as requested.";
mysql_query ("UPDATE users SET password='$pass_new' WHERE userid='$id'");
}
}
}
}
?>
Also, here is the code for my form.
<FORM method=post action="<?php echo $PHP_SELF; ?>">
<p class="Sidemenu"><b>ID</b></td>
<td width="8%" class="Normal" align="right" height="15">
</td>
<td width="34%" class="Normal" align="right" height="15">
<p class="Sidemenu"><b>Current Password</b></td>
</tr>
<tr>
<td width="25%" class="Date" align="right" rowspan="5" valign="top" height="108">
<input type="text" name="id" size="20" style="border: 1px solid #0B4694"></td>
<td width="8%" class="Date" align="right" rowspan="5" valign="top" height="108">
<img border="0" src="images/magic.png" width="61" height="28"></td>
<td width="34%" class="Date" align="right" height="20">
<input type="password" name="pass_old" size="20" style="border: 1px solid #0B4694">
</td>
</tr>
<tr>
<td width="34%" class="Normal" align="right" height="16">
<p class="Sidemenu"><b>New Password</b></td>
</tr>
<tr>
<td width="34%" class="Date" align="right" height="20">
<input type="password" name="pass_new" size="20" style="border: 1px solid #0B4694">
</td>
</tr>
<tr>
<td width="34%" class="Normal" align="right" height="16">
<p class="Sidemenu"><b>Confirm New Password</b></td>
</tr>
<tr>
<td width="34%" class="Date" align="right" height="20">
<input type="password" name="pass_new2" size="20" style="border: 1px solid #0B4694">
</td>
</tr>
<tr>
<td width="33%" class="Date" align="right" height="19" colspan="2"> </td>
<td width="34%" class="Date" align="right" height="19"><br>
<a href="#" border="0" onclick="document.submit();">
<input type="submit" value="Change Password" style="font-size: 10pt; "></a></form></td>