compare passwords against wordpress database
Hey, everyone. I’ve been searching and wrestling with this for a while, so I thought I’d post what I found out.
If you need to see if a user entered the proper wordpress password OUTSIDE of the actual wordpress folder/application, you need to do an include and then use a few of wordpress’ internal functions to see if the user/password combo results in a valid wp user object. Here’s a rough draft of what I came up with…
<?require('blog/wp-blog-header.php'); //must appear before any page content?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> </HEAD> <BODY> <? $theUserObj=wp_authenticate("submittedPassword", $submittedUser); if(!empty($theUserObj->user_login) && !empty($theUserObj->user_pass))echo "Correct"; else echo "Incorrect"; ?> </BODY> </HTML>
- The topic ‘compare passwords against wordpress database’ is closed to new replies.