title: PHP Notice: Undefined index: HTTP_USER_AGENT in line 2
body: <p>I have added a 3 line code at the top of the index page to eliminate the bad request which occurs in imac devices. The code is given below:</p>
  
  <pre><code>&lt;?php
  if (preg_match ("/CaptiveNetworkSupport/", $_SERVER["HTTP_USER_AGENT"])) {
  header ("HTTP/1.0 400 Bad Request");
  exit ();
  }
  ?&gt;
  </code></pre>
  
  <p>But I can see lots of "PHP Notice:  Undefined index:  HTTP_USER_AGENT in " errors in the error_log. How can I remove these logs?</p>
  
  <p>Thanks!</p>