Jump to content


This topic is now archived and is closed to further replies.


Password protecting a page

Recommended Posts

Need some help

Got a file called register.php and it prints a box where to type a password and the rest:

<div id="wrap">
<p>Enter the password given by the admin to continue: </p>
<form action="register2.php" method="post">
Password: <input name="pass1" type="password" />
<input type="submit" />

Now register2.php is: (it checks that the password enter is psb)


$pass1 = $_POST['pass1'];

if ($pass1 == "psb") {include("phpAuth_adduser.php");} else {

echo "Wrong Password";}


The phpAuth_adduser.php is a simple registration:

If the password is right it shows the right things etc....

But when i submit the registration it's printing Wrong Password each time. any ideas ?

Share this post

Link to post
Share on other sites
I tested your code and it is working fine on my end.  I don't know what the problem could be.

I type in 'psb' as the password and it works just fine

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.