title: xajax not executing when include is wraped in php if tags
body: <p>I have and extremely weird problem. My page below.
  on line 11 I basically include my xajax library and my php functions when user exists via the if($row_cnt == '1').</p>
  
  <p>Now all the code works perfectly (When I remove the if statement), but it's like it's not including my xajax.inc.php file when it's in the IF statement.</p>
  
  <p>When I close my IF statement after I declare $test and remove the else statement the code works 100% and it even pass the the $test value to my function correctly so I know my IF statement are true. </p>
  
  <p>The exact code is running perfectly on 3 of my own servers but cant get it to run on my clients server. So I can only think it must be some kind of server setting that is doing this, but have no idea what setting it might be.</p>
  
  <pre><code>&lt;?php
  $config = parse_ini_file('config/config.ini'); 
  $mysqli = mysqli_connect($config['server'],$config['username'],$config['password'],$config['dbname'],3306);
  $_login_password = mysqli_real_escape_string($mysqli, $_POST['login_password']);
  $sql = "SELECT 
  a.`id`, a.`name`, a.`surname`, `username`, `password`, `user_level`   
  FROM `comp_mfm_users` AS a 
  WHERE (a.`username`='$_POST[login_username]' AND a.`password`='$_login_password') LIMIT 1";
  $result = $mysqli-&gt;query($sql);
  $row_cnt = $result-&gt;num_rows;
  if($row_cnt == '1'){
  $test = "IN";
  
  include_once("xajax/xajax_core/xajax.inc.php");
  
  $xajax = new xajax();
  
  // Included Functions
  require_once("functions/test.php");
  // Request
  $xajax-&gt;processRequest();
  }
  else{
  $test = "OUT";
  }
  ?&gt;
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;?php $xajax-&gt;printJavascript('xajax/'); ?&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  var clicks = 0;
      function onClick() {
          var php = "&lt;?php echo "$test" ?&gt;";
          clicks += 1;
          xajax_test(clicks,php);
      };
  &lt;/script&gt;
  &lt;div id="mainContent"&gt;&lt;?php echo "$test" ?&gt;&lt;/div&gt;
  &lt;input type="button" value="click Here" onclick="onClick();"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The function I'm calling:</p>
  
  <pre><code>&lt;?php
  $xajax-&gt;registerFunction("test");
  function test($in,$in2){
  
  $content = &lt;&lt;&lt;EOF_
  Teast Page : $in : $in2
  EOF_;
  
  
  $objResponse = new xajaxResponse();
  $objResponse-&gt;assign("mainContent","innerHTML", $content);
  return $objResponse;    
  }
  ?&gt;
  </code></pre>
  
  <p>Okay this is completely bowling me over. I tried a different approach and skip the IF statement to load the includes. Xajax still not executing. The php code is working, it's loading page when username and password is correct and it exit when it's not so again no error in the php code. But here comes the starnge part, when I remove:</p>
  
  <pre><code>if($stmt-&gt;num_rows !== 1){
  echo "You are logged out";
  exit();
  }
  </code></pre>
  
  <p>All is good and everything is working except for there is no user verification. So I went one step further and moved the: </p>
  
  <pre><code>if($stmt-&gt;num_rows !== 1){
  echo "You are logged out";
  exit();
  }
  </code></pre>
  
  <p>Below/After the Line:</p>
  
  <pre><code>// Request
  $xajax-&gt;processRequest();
  </code></pre>
  
  <p>And all is working 100%. This doesn't make sense at all! I take the exact code and run it on my test server and it's working 100% with the code like it is below, but when I put it on the client server I have to move the IF statement down to the line mentioned above for it to work. The problem still is I can not use this code, it's not very good security the page can be halted before the exit(); command so I need the includes to be inside the IF statement.</p>
  
  <p>So the real question is why is the client server behaving like this, it must be a php setting in the .ini file for but witch one is the million dollar answer. </p>
  
  <p>Below Are the altered code with the IF statement still above the include where it's not working on client server but it's working on my test server. </p>
  
  <pre><code>&lt;?php
  $config = parse_ini_file('config/config.ini'); 
  $mysqli = mysqli_connect($config['server'],$config['username'],$config['password'],$config['dbname'],3306);
  $_login_password = mysqli_real_escape_string($mysqli, $_POST['login_password']);
  
  $stmt = $mysqli-&gt;prepare("
  SELECT 
  a.`id`, a.`name`, a.`surname`, `user_level`   
  FROM `comp_mfm_users` AS a 
  WHERE a.`username`=? AND a.`password`=? LIMIT 1
  ");
  $stmt-&gt;bind_param('ss', $_POST[login_username], $_login_password);
  $stmt-&gt;execute();
  $stmt-&gt;store_result();
  $stmt-&gt;bind_result($myrow[id], $myrow[name], $myrow[surname], $myrow[user_level]);
  $stmt-&gt;fetch();
  
  if($stmt-&gt;num_rows !== 1){
  echo "You are logged out";
  exit();
  }
  
  include_once("xajax/xajax_core/xajax.inc.php");
  
  $xajax = new xajax();
  
  // Included Functions
  require_once("functions/test.php");
  
  // Request
  $xajax-&gt;processRequest();
  ?&gt;
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;?php $xajax-&gt;printJavascript('xajax/'); ?&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  var clicks = 0;
      function onClick() {
          var php = "in";
          clicks += 1;
          xajax_testpp(clicks,php);
      };
  &lt;/script&gt;
  &lt;?php
  $dis = &lt;&lt;&lt;EOF_
  &lt;div id="mainContent"&gt;$myrow[surname]&lt;/div&gt;
  &lt;input type="button" value="click Here" style="cursor:pointer" onclick="onClick();"&gt;
  EOF_;
  echo"$dis";
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>