Jump to content

Recommended Posts

Hey there,

 

Now usually after a while I can always solve bugs with my code but this one really has me at a halt here.

 

So basically I have a function that returns true if the accounts username = demo and false if it doesn't but the following if statement returns true and executes the code every time regardless of the returned value of the function like so:

 

if(isset($_POST['server_start']) or isset($_POST['server_stop']) or isset($_POST['server_restart']) && $Class['Account']->is_demo_account($_SESSION['account_id']) == false)

 

 

Now if I run the following code right above that:

 

if($Class['Account']->is_demo_account($_SESSION['account_id']) == false) echo "it isn't a demo account.";
else echo "it is a demo account.";

 

It will echo "it is a demo account" correctly. Now can somebody please tell me why the if statement with the post values in always return true.

 

Thanks for your time!

Link to comment
https://forums.phpfreaks.com/topic/224888-comparison-issues-if-statement/
Share on other sites

Are you trying to get a TRUE evaluation: if (any one or more of the first 3 conditions) AND (last condition) ?

 

Yea I'm trying so if any of the first 3 conditions are set and the last condition is false. So E.G if it isn't the demo account.

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.