Darkranger85 Posted March 25, 2012 Share Posted March 25, 2012 Hey guys, I'm having a problem with my code and am hoping that someone can help me narrow it down. The full error I get is as follows: Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ')' in C:\wamp\www\testsite\login.php on line 9 Here is the code is question <?php include 'core.inc.php'; include 'connect.inc.php'; session_start(); $username = strip_tags(trim($_POST['user'])); $password = strip_tags(trim($_POST['pass'])); if(!empty($username&&$password)){ mysql_select_db('adatabase') or die('Couldnt connect to db!'); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if($numrows != 0){ while ($row = mysql_fetch_assoc($query)){ $dbusername = $row['username']; $dbpassword = $row['password']; $salt = $row['salt']; $password = crypt($password,$salt); $seclevel = $row['seclevel']; } if($seclevel > 1){ die('Please activate your account before logging in.'); } if ($username == $dbusername && $password == $dbpassword){ echo "Welcome back! Click <a href='overview.php'>here</a> to proceed!"; $_SESSION['username'] = $dbusername; }else{ echo "Incorrect username or password!"; } }else{ die ('Incorrect username or password!'); } }else{ die('Please enter a username and password!'); } ?> I've been staring at it all morning and I cant for the life of me figure out where a parenthesis is missing. I went down the code line by line and checked every single one to make sure it had a "mate" so to speak. And as for the unexpected "T_BOOLEAN" I have no idea lol. Thanks for your help in advance! Quote Link to comment https://forums.phpfreaks.com/topic/259692-unexpected-t_boolean-error/ Share on other sites More sharing options...
Drummin Posted March 25, 2012 Share Posted March 25, 2012 Change this line if(!empty($username) && !empty($password)){ Quote Link to comment https://forums.phpfreaks.com/topic/259692-unexpected-t_boolean-error/#findComment-1330972 Share on other sites More sharing options...
Zane Posted March 25, 2012 Share Posted March 25, 2012 $username&&$password That is the unexpected T_BOOLEAN You cannot group together variables inside the empty function You'll need to perform two of them... using that same T_BOOLEAN if( !empty($username) && !empty($password) ) { Quote Link to comment https://forums.phpfreaks.com/topic/259692-unexpected-t_boolean-error/#findComment-1330973 Share on other sites More sharing options...
Darkranger85 Posted March 25, 2012 Author Share Posted March 25, 2012 Noted! And it works! Thank you both for your very quick replies! Quote Link to comment https://forums.phpfreaks.com/topic/259692-unexpected-t_boolean-error/#findComment-1330974 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.