title: PHP input field (with username), check if username is in active directory
body: <p>I have a form with the following input of a username:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
  &lt;label class="control-label col-sm-2" for="affuser"&gt;Affected User: &lt;font color="red"&gt;*&lt;/font&gt;&lt;/label&gt;
  &lt;div class="col-sm-10"&gt; 
    &lt;input type="affuser" class="form-control" name="affuser" id="affuser" placeholder="Username" value="" required="required"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I would now like to check if this user is also in an active directory of my company. So when a username is written in the input field and the cursor gets out of the field (for example) then there should be a check if this user is in the AD or not. If it is then the borders should become green, if not the borders of the input field should become red. And if there is a "wrong" input the field should also not be able to be submitted.</p>
  
  <p>How can I solve this as good as possible?</p>