• WordPress password authentication without WordPress, how can I do that? I want my visitors on the page test.php to belogged in to view the content of the page that has nothing of WordPress, but they have to login with ther WordPress login

Viewing 3 replies - 1 through 3 (of 3 total)
  • Bump.

    I have the same question.

    same question here, too.

    Well, you would have to make a login with PHP to do that that reads from the wordpress database. It would be really easy to do. Heres an example

    if (isset($_POST['submit'])) {
           $dbc = mysql_connect('database location here, 'username here', password here');
           @mysql_select_db('database you installed wp in');
    
    	// username and password sent from signup form
    	$username=$_POST['username'];
    	$password = md5($_POST['password']);
    	$query= "SELECT username, password FROM wp_users WHERE user_login = '$username' AND user_pass = '$password';";
    	$result=mysql_query($query);
    	// Mysql_num_row is counting table row
    	$count=mysql_num_rows($result);
    	// If result matched $myusername and $mypassword, table row must be 1 row
    	print "<p>$count</p>";
    	if($count==1){
    		// Register $myusername, $mypassword and redirect to file "login_success.php"
    		$_SESSION['username'] = $username;
    		header ('Location: admin.php');
    		exit();
    	}else {
    		echo "<font color=\"red\">Wrong Username or Password</font>";
    	}
    }
    ?>

    This will search the wordpress database for a result matching whats in there. So, if you fill in the fields correctly with your own database location, username and password, this code will work. If not, it will tell you that your username and password is wrong. Hope this helps. If you need help, just email me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress authentication stand-alone’ is closed to new replies.