Hello everybody,
The following code is used to change my password.Now, before this password is changed, i want to do a simple check, i.e it has to check for the old password.IF THE OLD PASSWORD ENTERED IS THE SAME AS THAT IS IN THE TABLE, THE PASSWORD HAS TO BE CHANGED,else it has to give me an erro message, that the old password entered is wrong.
Any ideas how can i do that??
Thanks in advance
<?
include "dbconnection.ini";
if ($submit)
{
if ($newpassword <> $newpassword2)
{
echo "Passwords do not match. please re-enter passwords!";
exit;
}else
{
$sql="update TBL_USER set USER_PASSWORD= '".md5($newpassword)."' where USER_NAME ='admin'";
$result=ibase_query($connection,$sql);
}
if (!$result)
{
echo "Error executing the update statement. <br />Interbase Reported:".ibase_errmsg()." <br/>".
"SQL=$sql_update<br />\n";
}else
{
echo "Password successfully changed!";
}
} else {
echo"<link rel=\"stylesheet\" type=\"text/css\" href=\"../formate.css\">";
echo"<form action=\"$PHP_SELF\" method=\"POST\">\n";
echo"<h4>Change administrator password</h4>";
echo"<table border=\"0\" width=\"364\" height=\"1\">
<tr>
<td width=\"185\" height=\"17\">New password</font></td>
<td width=\"163\" height=\"17\">
<p><input type=\"password\" name=\"newpassword\"></p>
</td>
</tr>
<tr>
<td width=\"185\" height=\"1\">Repeat new password</font></td>
<td width=\"163\" height=\"1\"><input type=\"password\" name=\"newpassword2\"></td>
</tr>
</table>";
echo"<input type=\"image\" src=\"../images/sign_save.gif\" value=\"submit\" name=\"submit\">";
echo"<input type=\"hidden\" value=\"submit\" name=\"submit\">";
echo"</form></body></html>";
}
?>