• I am trying to use the WordPress usernames and passwords to authenticate other pages to keep people from having two separate accounts on one site. This is my current code however it will not authenticate; I know the problem is that password is not being converted correctly. How can I get the password to work properly?

    <?php
    require_once('../inc/db_conn_wp.php');
    if ($_POST['submit'])
    	{
    	$username = ($_POST['username']);
    	$password = md5($_POST['password']);
    
    	$result = mysql_query("SELECT * FROM wp_users WHERE user_login = '$username' AND user_pass = '$password'", $conn);
    	$myrow = mysql_fetch_array($result);
    	$cnt = mysql_num_rows($result);
    	echo "CNT: ".$cnt;
    	}
    else
    	{
    	printf ("<form method=post action=\"lg.php\">");
    	printf ("username:&nbsp;&nbsp;<input type=text size=30 name=username>");
    	printf ("password:&nbsp;&nbsp;<input type=password size=30 name=password>");
    	printf ("<input type=Submit STYLE=font:bold 14px name=submit value=\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Submit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"><br />");
    	}
    ?>

    If I remove the password option from the query it works fine.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Using WordPress to authenicate other pages’ is closed to new replies.