title: Header redirect and Session start() generating errors
body: <p>I am using following code. I get errors:</p>
  
  <p>Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/mc/cpanel/Source/verifylogin.php:11)</p>
  
  <p>Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/public_html/mv/cpanel/Source/verifylogin.php:11)</p>
  
  <p>Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/public_html/mv/cpanel/Source/verifylogin.php:11) </p>
  
  <pre><code>&lt;?php
      error_reporting(E_ALL^ E_NOTICE);
      ob_start();
      require("../Lib/dbaccess.php");
  
      $inQuery = "SELECT mhuserid, mhusername FROM cpanelusers WHERE mhusername = '". $_POST['UserName'] ."' AND mhpassword = '". hash('sha512', $_POST['Password']) ."'";
  
      try
      {
          $Result = dbaccess::GetRows($inQuery);
          echo $Result;
          $NumRows = mysql_num_rows($Result); 
          if ($NumRows &gt; 0)
          {
              header("Location: http://www.example.com/cpanel/mainwindow.php");
              session_start();
          }   
          else
          {
              header("Location: http://www.example.com/cpanel/");
              echo "Last login attempt failed.";
              exit;
          }
      }
      catch(exception $e)
      {
  
      }
      ob_clean();
  ?&gt;
  </code></pre>
  
  <hr>
  
  <p>I did all the changes and reduced the code like below, still it is not working.</p>
  
  <pre><code>&lt;?php
      ob_end_clean();
      error_reporting(E_ALL^ E_NOTICE);
      require("../Lib/dbaccess.php");
      ob_start(); 
      $inQuery="SELECT mhuserid, mhusername FROM cpanelusers WHERE mhusername = '".$_POST['UserName']."' AND mhpassword = '".hash('sha512', $_POST['Password'])."'";
      try
      {
          $Result=dbaccess::GetRows($inQuery);
          $NumRows=mysql_num_rows($Result); 
          if ($NumRows&gt;0)
          {
              header("mainwindow.php");
          }   
          else
          {
              header("index.html");
          }
      }
      catch(exception $e)
      {
      }
  ?&gt;
  </code></pre>