Jump to content

If + Or? hmm login script not working?


AbydosGater

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
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.