Location: PHPKode > scripts > User Checker > user-checker/userchecker.example.php
Available functions:
	function __construct($user, $pass, $passcheck = 'md5', $session = FALSE)
	function set_db_connection($serveraddr, $serveruser, $serverpass, $serverdbname)
	function set_table($dbtable)
	function set_fields($userfield, $passfield)
	function validate()
	function print_query()
	function get_user_info()

//Get user data
$username = $_POST['username'];
$password = $_POST['password'];

//Set MySQL information
$serveraddr = '';
$serveruser = 'root';
$serverpass = 'toor';
$serverdbname = 'users';

//Start session (not needed as the script will do it itself if no session is present)

//Username and password can be passed directly as the class takes care of injection attempts
//Remember to set the connection information using set_db_connection()!
$user = new User($username, $password, 'md5');
$user->set_db_connection($serveraddr, $serveruser, $serverpass, $serverdbname);
$user->set_fields('username', 'passwordhash');

//Start output
<title>Simple login page</title>

if ($user->validate())
	echo "Congratulations, your credentials have been accepted!";
else if ($user->validate() < 1 || empty($username) || empty($password))
	?><form action="" method="post"><input type="text" name="username" /><input type="password" name="password" /><input type="submit" value="Login" /></form><?php
Return current item: User Checker