Title: WordPress authentication stand-alone
Last modified: August 19, 2016

---

# WordPress authentication stand-alone

 *  [denware](https://wordpress.org/support/users/denware/)
 * (@denware)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/wordpress-authentication/)
 * 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)

 *  [cbrunner](https://wordpress.org/support/users/cbrunner/)
 * (@cbrunner)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/wordpress-authentication/#post-874433)
 * Bump.
 * I have the same question.
 *  [Ahmad Bagadood](https://wordpress.org/support/users/tawqee3/)
 * (@tawqee3)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/wordpress-authentication/#post-874434)
 * same question here, too.
 *  [compguru910](https://wordpress.org/support/users/compguru910/)
 * (@compguru910)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/wordpress-authentication/#post-874435)
 * 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.

## Tags

 * [authentication](https://wordpress.org/support/topic-tag/authentication/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 4 participants
 * Last reply from: [compguru910](https://wordpress.org/support/users/compguru910/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/wordpress-authentication/#post-874435)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
