AbydosGater Posted September 30, 2006 Share Posted September 30, 2006 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? ThanksAbydos Link to comment https://forums.phpfreaks.com/topic/22606-if-or-hmm-login-script-not-working/ Share on other sites More sharing options...
Orio Posted September 30, 2006 Share Posted September 30, 2006 You need to use || for OR.Orio. Link to comment https://forums.phpfreaks.com/topic/22606-if-or-hmm-login-script-not-working/#findComment-101484 Share on other sites More sharing options...
obsidian Posted September 30, 2006 Share Posted September 30, 2006 [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 https://forums.phpfreaks.com/topic/22606-if-or-hmm-login-script-not-working/#findComment-101500 Share on other sites More sharing options...
AbydosGater Posted September 30, 2006 Author Share Posted September 30, 2006 Oh Great THanks,Fast reply! Thanks Link to comment https://forums.phpfreaks.com/topic/22606-if-or-hmm-login-script-not-working/#findComment-101565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.