Sorry to be a pain (again), I've got everything working on my update script *yay* EXCEPT, check and change current password...this is my code:
I keep getting this error:
The password you entered does not match the password entered in the system. If you have lost your password, please use the lost password link to have a new password emailed to you
But it's correct...I've tried several ways to rewriting this script and I keep getting the same error...any ideas?
PHP:
function check_current_pw( $username,$oldpw ) {
$query = "SELECT username,pw FROM $table WHERE username = '$username' AND pw = '$oldpw'";
$result = mysql_query( $query );
if( mysql_num_rows( $result ) > 0 )
return true;
else
return false;
}
if( !( check_current_pw( $_POST['username'],$_POST['oldpw'] ) ) )
{
$msg=$msg."<center>The password you entered does not match the password entered in the system. If you have lost your password, please use the lost password link to have a new password emailed to you</center>";
$status="NOTOK";}
if( $_POST['new_pw'] != $_POST['new_pw2'] )
{
$msg=$msg."<center>Password validation error. Please check if you have entered the new passwords correctly.</center>";
$status= "NOTOK";}
if ( strlen($_POST['new_pw'] ) < 3 or strlen($_POST['new_pw'] ) > 10 )
{
$msg=$msg."<center>Password must be more than 3 to 10 characters in length</center>";
$status= "NOTOK";}
$update = mysql_query("UPDATE $table SET pw = '$new_pw' WHERE username='$username' AND pw='$oldpw' LIMIT=1");
if( $msg != '' ) {
die( $msg );
}
I keep getting this error:
The password you entered does not match the password entered in the system. If you have lost your password, please use the lost password link to have a new password emailed to you
But it's correct...I've tried several ways to rewriting this script and I keep getting the same error...any ideas?