0

Hi everyone,

I have an Login page where the Admin enters his username and password and enter his, After he has enter into his page, there is a option for him to change his password..

Enter Current password:
Enter new password:
Confirm new password:

Confirm >>

When he clicks the confirm button the password gets updated..
How do we update the password in mysql.
Whats the php code to update the password.

Pls help..
Thanks..

6
Contributors
12
Replies
26
Views
7 Years
Discussion Span
Last Post by liza_1
0

first check current password using select query. if match current password with db value update that particular password with new password using update query in mysql.

0

Respected sir;
I need a code of this update password script,
please give me
Thanks & regards
zahid

0

Just a technique. Replace variables with form's variable and Update Query according to your table structure

<?php
$pass = $_POST['password'];
$rpass = $_POST['repeatpassword'];
if($pass==$rpass){
	$query = "UPDATE QUERY HERE";
	mysql_query($query);
}

?>
0

Just a technique. Replace variables with form's variable and Update Query according to your table structure

<?php
if($_POST['btn']=='Update'){

$old_pass=$_POST['opass'];

$new_pass=$_POST['npass'];

$query="UPDATE users set password='$new_pass' where password='$old_pass'";
mysql_query($query);
?>

is it write sir?

0
<?php
if($_POST['btn']=='Update'){
$old_pass=$_POST['opass'];
$new_pass=$_POST['npass'];
if($old_pass==$$new_pass){
$query="UPDATE users set password='$new_pass' where password='$old_pass'";
mysql_query($query);

}
else{
echo "Password Doesn't match!!";
}


?>
0

first check current password using select query. if match current password with db value update that particular password with new password using update query in mysql.

hi thr,

Could u pls tell me how to write the codes..
I tried it out but cant get it updated... in the admin table..
Pls help...
Thanks

0

hi thr,

Could u pls tell me how to write the codes..
I tried it out but cant get it updated... in the admin table..
Pls help...
Thanks

Did you try the above trick

0

When using passwords, make sure you encrypt it. Saving raw passwords is not only bad practice, it's wrong. An extra security measure would be to encrypt the password before sending it VIA POST. This is easily done by using javascript, you never want to submit the raw password.

Just some advice to add a little security.

0

i need help for my project..

we are taskesd to create a website yet i don't have codes for the LOG IN button
can please give me ?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.