title: Check String and User Agent
body: <p>I am trying to setup a PHP snippet that checks if 2 conditions are met and if they are, it echoes some text. The conditions are:</p>
  
  <ol>
  <li>That the query string equals a certain value.</li>
  <li>That the browser is Firefox.</li>
  </ol>
  
  <p>It's checking the query string properly but, it doesnt seem to be working for the browser (user agent).  See below:</p>
  
  <pre><code>&lt;?php
  
  function get_user_browser()
  {
      $u_agent = $_SERVER['HTTP_USER_AGENT'];
      $ub = '';
      if(preg_match('/Firefox/i',$u_agent))
      {
          $ub = "firefox";
      }
      else
      {
          $ub = "other";
      }
  
  } 
  
  if (isset($_GET['print']) &amp;&amp; $_GET['print'] != "" &amp;&amp; $ub = 'firefox') 
  {
      $pg = $_GET['print'];
      if (!file_exists('1')) 
      {
          echo '&lt;b&gt;It worked!&lt;/b&gt;';
      }
  }
  else 
  {
      echo '';
  }
  
  ?&gt; 
  </code></pre>
  
  <p>Any help would be appreciated.</p>