Why does this php code not work if ((a==a and b==b) or (c==c)) {}
I can't find why and/or in one line of if doesn't work it gets a=a and b=b that works but it wont get c=c that doesn't work
Example:
if ((a==a and b==b) or (c==c)) {}
Actual code:
if (($_POST['name'] == $naam and $_POST['password'] == $wachtwoor开发者_C百科d) or ($loggedin == 1)) {
($_POST['name'] == $naam and $_POST['password'] == $wachtwoord
is true if the username and password match. ($loggedin == 1)
is true if the user is logged in. The combination of these roughly means "is this a valid user?", where a valid user either provided their credentials with this request or was already verified to be logged in.
I found the solution.
Problem was not that part of the code but using an elseif with an !isset for a $_post. So now only it would go to the elseif if there was a $_post and would always ignore the or whatever I put there. It really made it seem like or didn't work stupid I'm ashamed.
Thank you all tough for the fast responses, and I didn't know about var_dump yet so thanks for that.
精彩评论