Well that's as simple as making a separate PHP file, e.g. config.php, that looks like:
<?php
$auth_user = 'user';
$auth_pass = 'pass';
?>
Then simply [man]include/man/[man]require/man it in your main script to check passwords:
require_once 'config.php';
if(!isset($_POST['username'], $_POST['password'])) {
// one or the other wasn't set... display form
} elseif($_POST['username'] == $auth_user && sha1($_POST['password']) == $auth_pass) {
// authenticated!
} else {
// invalid credentials!
}
Note that in my example above, I used the SHA1 hash of the password instead of having the password stored in plain text in the config file.