0
PHP functions
<?
if($_REQUEST['salva_ed']){
$sqlu="update registration set username='$username', firstname='$fname', lastname='$lname', sex='$gender',
birth_date='$bdate', addressline1='$address1',addressline2='$address2', complemento='$address3', numero='$address4', city='$city', state='$state',
country='$country', postcode='$zipcode', phone='$phone', mobile_no='$mobileno', full_mobileno='$fullmobile',
email='$email', password=MD5('$pass'), cpf='$cpf',rg='$rg' where id='$id'";
$resultu=mysql_query($sqlu);
header("location:message.php?msg=3"); exit;
}
if($_REQUEST['salva_nv']){
$verifcode = md5($username);
$agora=Date("Y-m-d H:i:s");
$sqlu="insert into registration (username,firstname,lastname,sex,birth_date,addressline1,addressline2,city,state,
country,postcode,phone,mobile_no,full_mobileno,email,password,cpf,rg,register_date,verify_code,
final_bids,account_status,member_status,user_delete_flag,sponser,sms_flag,admin_user_flag) values
('$username','$fname','$lname','$gender','$bdate','$address1','$address2','$address3','$address4','$city','$state',
'$country','$zipcode','$phone','$mobileno','$fullmobile','$email',MD5('$pass'),'$cpf','$rg','$agora','$verifcode',
0,0,'0','',0,'0','0')";
//echo $sqlu; exit;
$resultu=mysql_query($sqlu);
header("location:message.php?msg=2"); exit;
}
?>
HTML
<tr>
<td class="normal" align="right"><font class="a">*</font> Senha de acesso: </td>
<td><input style="width:60%" type="password" name="pass_word" value="<?=$pass?>"/></td>
</tr>
<tr>
<td class="normal" align="right"><font class="a">*</font> Confirmação de senha: </td>
<td><input style="width:60%" type="password" name="cpassword" value="<?=$pass?>"/></td>
</tr>
<input type="submit" value="Atualizar cadastro" name="Editar" class="bttn" /></td>
Guys, I got a problem here and I couldn’t find a solution.
This is an admin panel, I implemented it to save the passwords in MD5 in DB.
There are two functions, one to execute when editing a current client and one to create a new client (salva_nv)...
The problem is in the function of editing the client (salva_ed), in the password fields.
When I edit it changes the password of the client generating another MD5.
How to make it check if the record is the same in the column, and not replace the current password?
When loading the page it already automatically fills the fields with the current password, but it shows in MD5, so if I save it will change in DB generating a new MD5 key.
I saw on the internet that it is possible to use "Constraint" to accomplish this task, but I could not implement.
Does anyone have any tips?
I have another problem here, I updated the question can give me another tip? rsrs
– Wendler