如果我输入错误的密码是正确的,那么甜蜜警报显示错误密码的状态但是如果我使它们正确,它仍然显示错误密码的状态不会出现问题
Php代码
if($new_pass_hash != $pass_hash){
echo"Current password is wrong";
exit();
}else{
$updated_pass_hash = sha1($enew.$salt);
$update_pass = " UPDATE vendor SET pass_hash = '$updated_pass_hash' WHERE vd_id='$vd_id'";
$run_update = mysqli_query($con, $update_pass);
echo"Updated";
}
响应
$.ajax({
type:"POST",
data: "pass=" +pass + "&enew="+enew+"&repeat="+repeat,
url:"phpfiles/edit-password.php",
success: function(data){
if(data =='Updated'){
swal({
title: 'Success',
text: 'Password updated successfully' ,
imageUrl: "icons/thumbs-up.jpg"
},
function(){
window.location.href = 'docs.php';
});
}else{
swal({
title: 'Error',
text: 'Current password is wrong',
type: 'error'
});
}
}
});
return false;