I am building a jQuery file to validate user input for login on a wordpress site. I have made functions to check the wordpress database for usernames, emails, and passwords. I have the functions working perfectly for usernames and emails, however with the password function I get a 500 internal server error. The only thing I can think of that would be causing this would be my trying to include three files from wordpress. I have to use the class-phpass.php to check the passwords as the passwords are hashed and then stored into the database. The class-phpass.php file has a function called CheckPassword which compares a hashed password with the plain text password, then returns true if they match, false if they do not. I have also included the wp-settings.php and wp-load.php, just trying to get my php file to work for my validation.
I am creating this so that users will not be taken away from my login in lightbox if they type in a wrong username or password.
This is my jQuery function to check the password:
jQuery.post("/wp-content/themes/Landing/includes/check_password.php", {password:pWd2, email:email},
function(data){
if( data == '1' )
{
CheckPassword = true;
}else{
//show that the password is NOT available
alert("The password and/or username you have entered is incorrect!");
CheckPassword = false;
}
});
UPDATE!!!::
Ok, I got my php file working like it should, and my jQuery.post is working as it should. I am having a logic error now, however. I am using chrome tools and stepping through the code, I need to return false to the form to keep the webpage from refreshing/redirecting. It seems to step through the function(data) after submitting for the check I have in place here:
if (CheckUsername == false){
return false;
}
if (CheckPassword == false){
return false;
}
else{
return true;
}
it checks ^ ^ that block of code before stepping into the post function and setting CheckPassword to false if password is incorrect.