The way I'd do it is to use file() to read the passwords into an array (I think you need to trim the whitespace from the elements of the array, that should be mentioned in the file() documentation), then loop through that array and see if any of the values is equal to the password the user inputted:
$passwords = file('passwords.dat');
$valid_pass = false;
foreach ($passwords as $pass) {
if ($HTTP_POST_VARS['ipass'] == $pass) {
$valid_pass = true;
break;
}
}
if ($valid_pass) {
echo 'welcome!';
} else {
echo 'go away!';
}
Of course, you'll want to make sure passwords.dat isn't publicly readable as it ordinarily would be... 🙂