Jump to content

Archived

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

AbydosGater

If + Or? hmm login script not working?

Recommended Posts

Hi,
Ive been working on a login script, and the main bit is...

[quote]
        <?php if($_POST['submit']){
if($username == $username2 && $password == $password2 | $username == $hackname && $password == $hackpass) {
session_register("username");
$_SESSION['username'] = $username;
echo "<font color=\"#FF0000\"><b>Thank you for login in,<br /> You will be redirected to the protected pages in 2 seconds <META HTTP-EQUIV=\"refresh\" CONTENT=\"2; URL=admin/index.php\"></b></font>";
}
} ?>
[/quote]
And it is pulling the USERNAME2 And PASSWORD2 and the hackname and hackpass from a config file, and i have tested it, and the variables are loading, now it worked before i added the hackname+pass variables to the if!

Ive been using | as an OR operator! is that correct? so its a login script but it has the two users, which are stored in another file, and now this was working before i added the second/"Hack" user, can anyone please help me?

Thanks
Abydos

Share this post


Link to post
Share on other sites
[quote author=Orio link=topic=110088.msg444343#msg444343 date=1159638659]
You need to use || for OR.

Orio.
[/quote]

you also should get into the practice of grouping your conditionals for reading ease:
[code]
if(($username == $username2 && $password == $password2) || ($username == $hackname && $password == $hackpass)) {
[/code]

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.