<?php
session_start();

error_reporting(0);

?>
<?php
ob_start();
?>
<?php 

include("connect.php");
$u_name = $_POST['email'];
$u_pass = $_POST['pwd'];
if ($_POST['Submit']=='Login')
{
$sql = "SELECT * FROM user WHERE 
            username = '$u_name' AND 
            password = '$u_pass'"; 

$result = mysql_query($sql) or die (mysql_error()); 
$cmd=mysql_fetch_array($result);
$num = mysql_num_rows($result);


if ($num)    
{    
$_SESSION['username'] = $u_name;
    echo '<META HTTP-EQUIV="Refresh" Content="0; URL=9807.php">';   

    exit;    
}    
else    
{    
    $errore_msg="Your username or Password is incorrect";


}   


}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Outbox News</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function validateForm()
{
var x=document.forms["myForm"]["email"].value;
var x1=document.forms["myForm"]["pwd"].value;
if (x==null || x=="")
  {
  alert("First name must be filled out");
  return false;
  }
  else
  if (x1==null || x1=="")
  {
  alert("password must be filled out");
  return false;
  }
}
</script>
<script>
function noBack()
{
window.history.forward(1);
}
</script>
<script language="JavaScript" type="text/javascript">

javascript:window.history.forward(1);

</script> 
</head>

<body >
<div id="main">





     <!--------------------content box---------------------------------->

        <div id="content_box">      
         <p> </p><table width="40%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td bgcolor="#d5e8f9" class="mnuheader" >
<div align="center"><font size="5"><strong>Login 
        Members</strong></font></div></td>
  </tr>
  <tr> 
    <td bgcolor="#e5ecf9" class="mnubody"><form name="myForm" method="post" action="" onsubmit="validateForm();">
    <p style="color:#FF0000;" align="center"> <?php echo $errore_msg  ; ?></p>
        <p> </p>
        <p align="center">Your Email 
          <input name="email" type="text" id="email">
        </p>
        <p align="center"> Password: 
          <input name="pwd" type="password" id="pwd">
        </p>
        <p align="center"> 
          <input type="submit" name="Submit" value="Login">
        </p>
        <p align="center"><a href="#">Register</a> | <a href="#">Forgot</a></p>
      </form></td>

  </tr>
</table>

        </div>

      <!--------------------content box close---------------------------------->
      <div id="add">

<a href="index.php" class="back">Back To Home page</a>      


      </div>

      <!--------------------footer---------------------------------->



      <!--------------------footer  close---------------------------------->

</div>
</body>
</html>

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\inetpub\vhosts\outboxnews.co.in\httpdocs\admin.php:2) in D:\inetpub\vhosts\outboxnews.co.in\httpdocs\admin.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\inetpub\vhosts\outboxnews.co.in\httpdocs\admin.php:2) in D:\inetpub\vhosts\outboxnews.co.in\httpdocs\admin.php on line 3

this warning is generate in server site but not at local host plese help me my code is

ob_start() must be before session_start().

<?php 
ob_start();
session_start();

And make sure there is no blank space before session_start().

ya no blank space before

my prblm is solve
thanks!

Make thread solved !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.