Jump to content


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


If + Or? hmm login script not working?

Recommended Posts

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

        <?php if($_POST['submit']){
if($username == $username2 && $password == $password2 | $username == $hackname && $password == $hackpass) {
$_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>";
} ?>
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?


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.


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

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.