PHP coding errors on SA built password update page
Hi, the PHP code that was generated by the Security Assist wizard for the password update page seems to be incorrect:
1) The error code is placed before the <body> tag which probably explains why the codes are displaying up at the very top above my navigation. I imagine I can move the PHP code to within the <body> tags where I would like it to display?
2) This is the most annoying error. It is displaying multiple messages at once. In other words it displays "You entered an incorrect passwordCongratulations You have successfully changed your password" all in one run on sentence. This also displays automatically no matter what the user enters in.
3) The errors are displaying even if you don't hit the "submit" button. It is displaying even if you just refresh the page.
Here is that portion of the code:
$username = $_POST['username'];
$password = $_POST['password'];
$newpassword = $_POST['newpassword'];
$confirmnewpassword = $_POST['confirmnewpassword'];
$result = mysql_query("SELECT password FROM users WHERE username='$username'");
echo "The username you entered does not exist";
if($password!= mysql_result($result, 0))
echo "You entered an incorrect password";
$sql=mysql_query("UPDATE users SET password='$newpassword' where username='$username'");
echo "Congratulations You have successfully changed your password";
echo "The new password and confirm new password fields must be the same";
Please help! Thanks!