It can be even simpler than that, but that should work. Here is what I'd write:
For the password page, save as a .php file, and use this format:PHP Code:$f = explode("\n",file_get_contents('myfile.php'));
unset($f[count($f)]); unset($f[0]); sort($f); //remove the PHP line at top of file
if (in_array($password)) {
//ok
include('loggedinpage.php'); //probably
}
else
{
header("location: login.php")
}
Also, here is another easy way: Store the passwords in an array in a php file.PHP Code:<?php die('You may not view this page.'); //or 'error' ?>
password1
password2
password3
etc...
?>
include() that page, and check if $passwords[$pass] is set. If so, it's value will tell you the permission level.PHP Code:$passwords = array(
'pass1' => 'full';
'pass2' => 'some';
'pass3' => 'some';
'pass4' => 'limited'
);
(You could just type this list in your page directly, if it is short enough to not make things messy.)
It's better if you understand this than if I write it for you, so you can make it fit exactly how you want.
Now that you see these functions, I hope it is easy to adjust.
Note: The reason for having the line at the top of die() on the included page is so that you can't just view the passwords. That will skip it. Then the parsing page knows to ignore the first (and last) line.
Good luck. If you don't understand part of it, ask. I didn't explain every line, but you should be able to guess what it does. Not much is unexpected.
