I created a simple login for with just two inputs username and password. Im using ajax to pass the data being this will be used in a mobile app. For some reason, I am having an issue verifying my credentials against whats stored in the db. I am using standard PDO and a very simple ajax formData call.
My form:
Username
data-corners="true" />
Password
data-mini="true" data-corners="true" />
LOGIN
My ajax POST method in the head of my doc (in the same document as my form):
var fd = new FormData( $(this)[0] );
var username = $("#uName").val();
var password = $("#uPass").val();
$.ajax({
type: 'POST',
processData: false,
contentType: false,
async: false,
//data: { user: username, pass: password },//
data: fd,
url: 'urltomylogincheck/loginChk.php',
success: function(html){
if(html==1) {
//$("#add_err").html("right username or password");
sessionStorage.setItem("user",username);
alert('Wait while we log you in');
window.location.href = 'user.html';
}
else {
$("#add_err").css('display', 'inline', 'important');
$("#add_err").html("
Wrong username or password
");
}
},
beforeSend:function()
{
$("#add_err").css('display', 'inline', 'important');
$("#add_err").html("Loading...
")
}
});
return false;
});
});
an my simple PHP check service:
session_start();
$user = $_POST['uName'];
$pass = md5($_POST['uPass']);
if(isset($user))
{
$check = $conn->prepare("SELECT * FROM profiletbl
WHERE user = :UserName and pass = :Password");
$check->bindParam(':UserName', $user);
$check->bindParam(':Password', $pass);
$check->execute();
$count = $check->rowCount();
$row = $check-> fetch();
if($count==1)
{
$_SESSION['uName'] = $row['user'];
///header("location: home.html");
}
else {
$errmsg_arr[] = 'Username and Password are not found';
$errflag = true;
session_write_close();
///header("location: about.html");
exit();
}
$check = null;
When i test the login, it simply get a response from loginCheck.php that says:

I've created a login before with no problem using mysqli but for some reason, Im starting to believe something in my ajax is causing the stink. Any help with this would be great.