Hi.. Note that Iam quite new at this :)
What I try to do is to give the option to members to update/change their password or email.
How do I tell when nothing is entered in password field lets say not to POST anything.
The code below checks if username and password are filled but it always POST the new password even if you don't enter anything
plus I don't get POST email.
$E_Mail=$_POST['E_Mail'];
$Username=$_POST['Username'];
$Password=md5($_POST['Password']);
$New_Password=md5($_POST['New_Password']);
if (!($Username && $Password)) {include 'update account_members.php';
echo "<center><font color=#FF0000><font size=4><font weight=bold>Username & Password are REQUIRED!</font></font></font></center>";
exit();
}
$result = mysql_query("SELECT Password FROM Register WHERE Username='$Username'");
if(!$result){
include 'update account_members.php';
echo "<center>Invalid Username</center>";
}
else
if($Password!= mysql_result($result, 0)){
include 'update account_members.php';
echo "<center>Invalid Password</center>";
}
if ($New_Password>0)
$sql=mysql_query("UPDATE Register SET Password='$New_Password' WHERE Username='$Username'");
if(sql)
exit();
if ($E_Mail>0)
$sql=mysql_query("UPDATE Register SET E_Mail='$E_Mail' WHERE Username='$Username'");
if(sql)
{
echo "<p> </p><p> </p><center><p>Update Successful!</p></center>";
}
Thank you.