View Full Version : script problem *HELP!*

12-29-2005, 11:10 PM
I am using a very simple php login script. I need to know if there is a way to require someone to type in the password for another .php file.
For example if I had the script in login.php and I had another file called protected.php could I add a line at the top of the php page to require the users to type in the password to see the content in protected.php? I have heard of the php require function but do not know how to use it???

here is the code:

$pass = $_POST['pass'];
if ($pass == 'rightpassword') {
echo 'right!';
} elseif ($pass == '') {
echo '';
} else {
echo 'wrong';
<h1><font color="red">AUTHORIZATION REQUIRED</font></h1>
<b><font color="red">Authorization is required past this point. You must enter the correct password to continue.</font></b>
<form action="/login/" method="post">
<input type="password" name="pass">
<input type="submit">

a live example can be found at : http://tst4php.6te.net/login/
thanks to anyone who can help!

12-30-2005, 07:48 PM
why do you have popups when i go to the page to help you?

12-31-2005, 12:04 AM
sorry it is because I am using free web hosting... can you help??