I am using following code. I get errors:
Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/mc/cpanel/Source/verifylogin.php:11)
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)
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)
<?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 > 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();
?>
I did all the changes and reduced the code like below, still it is not working.
<?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>0)
        {
            header("mainwindow.php");
        }   
        else
        {
            header("index.html");
        }
    }
    catch(exception $e)
    {
    }
?>
 
     
    