Log in

View Full Version : Dumb Question



connor4312
08-21-2010, 05:25 AM
Hello everyone, I have a pretty easy (I think) question. I've done my homework, but I can't seem to find why the following code won't work:


if (!$_POST["pass"]==="password")
{
die("Wrong Password or Security Code");
}
I tried echoing the POST above and it worked fine.

If it makes any difference, it's right below a reCaptcha confirmation and above all HTML tags.

Thanks,
Connor

traq
08-21-2010, 05:33 AM
Please describe what you're trying to do.

You might want:

if ($_POST["pass"] != "password"){ die("Wrong Password or Security Code"); }

or

if (!$_POST["pass"]){ die("Wrong Password or Security Code"); }

or something completely different. let us know.

connor4312
08-21-2010, 05:39 AM
Ah, that first one seems to work, thanks! I was doing it the C# way of putting the ! before the statement. It never occurred to me to check that.

djr33
08-21-2010, 05:44 AM
In php I believe that reverses the variable then computes. Using != or parentheses around the part to be inverted should work fine.