Member's Acount Update!!
Posted: Tue Jun 10, 2008 11:58 am
Hi.. Note that I am 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 the email in my db.
If I remove md5 from password fix the problem (doesn't post anything if empty) but I need the encryption.
Thank you.
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 the email in my db.
If I remove md5 from password fix the problem (doesn't post anything if empty) but I need the encryption.
Code: Select all
$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>";
}
$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)
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>";
}