would using a password protection thing such as this work?

<?
if ($pass != "mypassword") {
print('Invalid Password');
die;
}
?>