WP-Mix

A fresh mix of code snippets and tutorials

Simple PHP login form

Here’s a quick PHP snippet for creating a simple login form for your site.

Here is the magic PHP snippet to create a basic login form:

<?php 
// simple login form

$username = '';
$password = '';

if ( $_POST['username'] !== $username || $_POST['password'] !== $password ) { ?>

<h1>Member Login</h1>
<p>Please enter your credentials:</p>
<form name="form" method="post" action="http://deadletterart.com/dla/forum/">
	<p><label for="username">Username:</label><input type="text"     title="username" name="username" /></p>
	<p><label for="password">Password:</label><input type="password" title="password" name="password" /></p>
	<p><input type="submit" name="submit" value="Login" /></p>
</form>

<?php } else {

	// process successful login as normal

} ?>

Customize as needed, and remember to use strong passwords!

★ Pro Tip:

USP ProSAC Pro