My login form works fine unless the user passes strings like '1 or 1' or '1'='1' which ignores the login process and validate the user anyway.
Here is my client side code.
$scope.user_login=function(){
if($scope.user_name==''){
alert('user name filed should not keep blank');
loginField.borderColor('txtname');
}else if($scope.user_pass==''){
alert('password filed should not keep blank');
loginField.borderColor('txtpwd');
}else{
var userData={'user_name':$scope.user_name,'user_pass':$scope.user_pass};
$http({
method: 'POST',
url: "php/Login/login.php",
data: userData,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response){
console.log('login',response);
//alert("aa"+response.data['msg']);
if(response.data['user_type']=='1'){
$location.path('dashboard');
}
},function errorCallback(response) {
//alert(""+response.data['msg'].length);
if(response.data['msg'].length > 0)
alert(response.data['msg']);
$scope.user_name=null;
$scope.user_pass=null;
});
}
}
Please help me to resolve this issue.