Jump to content

Members accound update


Pavlos1316

Recommended Posts

Hi

 

Down there I am trying to set up an update account script.

 

I need members to be able to change password, and email or one of them.. So if iot is null one of them i don't want any change in my db.

 

What do I have to add? Cause I go until the script checks the username and password. can't post anything. I already have my connection string which is tested and works Perfect.

 

$E_mail=$_POST['E_mail'];
$Username=$_POST['Username'];
$Password=md5($_POST['Password']);
$New_Password=md5($_POST['New_Password']);
$EmailNewPassword=$_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)  {
  echo "Invalid Username";
  }
  else  if($Password!= mysql_result($result, 0))  {
  echo "Invalid Password";
  }
      $sql=mysql_query("UPDATE Register SET Password='$New_Password', WHERE Username='$Username'");
if(sql)exit();
if (!($Mail)) {
}else
  $sql=mysql_query("UPDATE Register SET Mail='$E_mail', WHERE Username='$Username'");
if(sql)
exit();
    {
      echo "<p> 
</p><p> </p><center><p>Update Successful!</p></center>";
}

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/109430-members-accound-update/
Share on other sites

You need to add EDIT logic.  So store their user ID in a session, when they click on the My Profile (or whatever you want to call it) link, have it load a form and populate it using their ID.  Then when they Save or Update, UPDATE their row.

I allready use regenerate id to store their id!!! at the top of my page.

 

Can you help me on how to do that?

plus using the above code when I change password it does change it. how do I say if new password is null not to post it and what is my mistake and it doesn't proceed to email?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.