Created
November 20, 2018 07:00
-
-
Save ErMandeep/139bb78e4305e893bbc00d09f7c8b028 to your computer and use it in GitHub Desktop.
here is change password code for simple match old password and enter new password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['update_psss'])){ | |
$oldpassword = $_POST['oldpassword']; | |
$newpassword = $_POST['newpassword']; | |
$confirmnewpassword = $_POST['confirmnewpassword']; | |
if ($oldpassword==$oldpassworddb){ | |
if (strlen($newpassword)>25||strlen($confirmnewpassword)<6) | |
{ | |
echo "Password must be betwwen 6 & 25"; | |
}else{ | |
if($newpassword==$confirmnewpassword){ | |
$sql="UPDATE users SET password='$newpassword' where id='$login_id'"; | |
$result = mysqli_query($connection, $sql); | |
if($result){ | |
header('Location: logout.php?success=1'); | |
} | |
} else | |
{ | |
echo "Passwords do not match"; | |
} | |
} | |
}else{ | |
echo "old password not matched"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment