Maybe using array's if you want even more then 2 passwords:
PHP Code:
<?php
session_start();
$cmp_pass = array();
$cmp_pass[] = "password1";
$cmp_pass[] = "password2";
$cmp_pass[] = "password3";
//For every password md5 encrypt it.
foreach($cmp_pass as $key => $value) {
$cmp_pass[$key]=md5($value)
}
//remove whitespace and then check for a password
if(!empty(trim($_POST['pass']))) {
$_SESSION['pass'] = md5($_POST['pass']);
} else {
die("No password given!");
}
//Is the correct password in the array?
if (!in_array($_SESSION['pass'], $cmp_pass) {
die("Wrong password!");
} else {
//do some stuff you'd like to do here ;)
}
?>
This also makes it easier if you are storing the passwords in a database