Skip to content

Instantly share code, notes, and snippets.

@ErMandeep
Created November 20, 2018 07:00
Show Gist options
  • Save ErMandeep/139bb78e4305e893bbc00d09f7c8b028 to your computer and use it in GitHub Desktop.
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
<?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