Cannot modify header information - headers already

Cannot modify header information - headers already

Posted by: stooo
Posted on: 2006-05-11 17:55:00

When logging in my page is throwing the following
errors.. I think this has to do with
extra blank spaces being in the config.ini php
file..which I can't seem to find:
Warning: Cannot modify header information - headers already sent by (output started at /home/.input/ddole/web.com/login.php:6) in /home/.input/ddole/web.com/login.php on line 164

How do I correct the error?

Thanks

Here is the code I copied from the website:
<html>
<head>
<title>Agent Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<tr>

</tr>
<tr>
<td rowspan="2" colspan="5"><img name="loginTemplate_r3_c8" src="images/loginTemplate_r3_c8.gif" width="273" height="45" border="0" alt=""></td>
<td colspan="3"><img src="images/loginTemplate_r3_c13.gif" alt="" name="loginTemplate_r3_c13" width="189" height="36" border="0" usemap="#loginTemplate_r3_c13Map"></td>
<td rowspan="2" colspan="2"><img name="loginTemplate_r3_c16" src="images/loginTemplate_r3_c16.gif" width="34" height="45" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="36" border="0" alt=""></td>
</tr>
<tr>
<td colspan="3"><img name="loginTemplate_r4_c13" src="images/loginTemplate_r4_c13.gif" width="189" height="9" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="9" border="0" alt=""></td>
</tr>
<tr>
<td rowspan="3" colspan="2"><img name="loginTemplate_r5_c1" src="images/loginTemplate_r5_c1.gif" width="26" height="206" border="0" alt=""></td>
<td colspan="15"><img name="loginTemplate_r5_c3" src="images/loginTemplate_r5_c3.gif" width="774" height="13" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="13" border="0" alt=""></td>
</tr>
<tr>
<td colspan="15"><img name="loginTemplate_r6_c3" src="images/loginTemplate_r6_c3.gif" width="774" height="3" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="3" border="0" alt=""></td>
</tr>
<tr>
<td colspan="2"><img name="loginTemplate_r7_c3" src="images/loginTemplate_r7_c3.gif" width="150" height="190" border="0" alt=""></td>
<td colspan="13" valign="top" bgcolor="#FFFFFF"> </td>
<td><img src="images/spacer.gif" width="1" height="190" border="0" alt=""></td>
</tr>
<tr>
<td rowspan="4"><img name="loginTemplate_r8_c1" src="images/loginTemplate_r8_c1.gif" width="10" height="371" border="0" alt=""></td>
<td colspan="3"><img name="loginTemplate_r8_c2" src="images/loginTemplate_r8_c2.gif" width="166" height="27" border="0" alt=""></td>
<td><img src="images/loginTemplate_r8_c5.gif" alt="Rate Plans" name="loginTemplate_r8_c5" width="104" height="27" border="0" onMouseOver="MM_swapImage('loginTemplate_r8_c5','','images/rplansOver.gif',1)" onMouseOut="MM_swapImgRestore()"></td>
<td colspan="3"><img src="images/loginTemplate_r8_c6.gif" alt="Availability" name="loginTemplate_r8_c6" width="99" height="27" border="0" onMouseOver="MM_swapImage('loginTemplate_r8_c6','','images/availsOver.gif',1)" onMouseOut="MM_swapImgRestore()"></td>
<td><img src="images/loginTemplate_r8_c9.gif" alt="Features" name="loginTemplate_r8_c9" width="76" height="27" border="0" onMouseOver="MM_swapImage('loginTemplate_r8_c9','','images/featuresOver.gif',1)" onMouseOut="MM_swapImgRestore()"></td>
<td colspan="2"><img src="images/loginTemplate_r8_c10.gif" alt="Frequently Asked Questions" name="loginTemplate_r8_c10" width="80" height="27" border="0" onMouseOver="MM_swapImage('loginTemplate_r8_c10','','images/faqOver.gif',1)" onMouseOut="MM_swapImgRestore()"></td>
<td colspan="2"><img src="images/loginTemplate_r8_c12.gif" alt="Support" name="loginTemplate_r8_c12" width="81" height="27" border="0" onMouseOver="MM_swapImage('loginTemplate_r8_c12','','images/supportOver.gif',1)" onMouseOut="MM_swapImgRestore()"></td>
<td><a href="login.php"><img src="images/loginTemplate_r8_c14.gif" alt="Sales Agents" name="loginTemplate_r8_c14" width="89" height="27" border="0" onMouseOver="MM_swapImage('loginTemplate_r8_c14','','images/agLoginOver.gif',1)" onMouseOut="MM_swapImgRestore()"></a></td>
<td colspan="3"><img name="loginTemplate_r8_c15" src="images/loginTemplate_r8_c15.gif" width="95" height="27" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="27" border="0" alt=""></td>
</tr>
<tr>
<td colspan="16"> </td>
<td><img src="images/spacer.gif" width="1" height="21" border="0" alt=""></td>
</tr>
<tr>
<td rowspan="2"> </td>
<td><img name="template_r8_c2" src="images/template_r8_c2.gif" width="1" height="1" border="0" alt=""></td>

<td colspan="14" rowspan="2" align="left" valign="top">
<?php
require "myweb.inc";
require "authentication.inc";
if (!empty($_POST["username"])&&!empty($_POST["password"]))
{
$user=$_POST["username"];
$pwd=$_POST["password"];
$connection = mysql_connect($hostname,$g_username,$g_password) or die("Could not connect");
mysql_select_db($database,$connection)or die ("could not select database");
if (authenticate_user($connection,$user,$pwd))
{
// session_start();
header("Location:registration.php");
}
else
{
print "<center> invalid username/password</center>";
}
}
?>
<form action="login.php" method="post" name="main" id="main" onSubmit="return checkForm();">
<table width="770" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="89"> </td>
<td width="152"> </td>
<td width="46"> </td>
<td colspan="4"><img src="images/loginbanner.gif" width="100" height="25"></td>
<td width="49"> </td>
<td width="109"> </td>
<td width="7"> </td>
<td width="96"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><span class="style1">Username</span></td>
<td colspan="4"><input name="username" type="text" id="username"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><span class="style1">Password</span></td>
<td colspan="4"><input name="password" type="password" id="password"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td width="39"> </td>
<td width="46"><input type="submit" value="Login"></td>
<td width="68"> </td>
<td width="1"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="4"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="4"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form></td>






<td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td><img name="loginTemplate_r11_c3" src="images/loginTemplate_r11_c3.gif" width="1" height="322" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="322" border="0" alt=""></td>
</tr>
<tr>
<td colspan="16"><img name="loginTemplate_r12_c1" src="images/loginTemplate_r12_c1.gif" width="799" height="10" border="0" alt=""></td>
<td rowspan="3"><img name="loginTemplate_r12_c17" src="images/loginTemplate_r12_c17.gif" width="1" height="28" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td>
</tr>
<tr>
<td colspan="16"><img name="loginTemplate_r13_c1" src="images/loginTemplate_r13_c1.gif" width="799" height="17" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="17" border="0" alt=""></td>
</tr>
<tr>
<td colspan="6"><img name="loginTemplate_r14_c1" src="images/loginTemplate_r14_c1.gif" width="282" height="1" border="0" alt=""></td>
<td colspan="4"><img name="template_r21_c8" src="images/template_r21_c8.gif" width="244" height="1" border="0" alt=""></td>
<td colspan="6"><img name="loginTemplate_r14_c11" src="images/loginTemplate_r14_c11.gif" width="273" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
</table>
<map name="loginTemplate_r3_c13Map">
<area shape="rect" coords="-4,3,47,24" href="index.php" alt="Myweb Networks">
<area shape="rect" coords="51,-6,126,19" href="#">
<area shape="rect" coords="135,-8,188,19" href="#">
</map>
</body>
</html>


Re: Cannot modify header information - headers already

Posted by: silkrooster
Posted on: 2006-05-11 20:31:00

Your php code sends header information. This header must be sent before any output to the browser. Meaning before any html code. There is a command to place a hold on the header and render all to once, but I don't recall at the moment.
You could try and move your php code to the top of your page, and use an if statement which will determine if the code should run or display the html.
Silk

Re: Cannot modify header information - headers alr

Posted by: guice
Posted on: 2006-05-11 20:41:00

My god, this was cross posted, too? Dude, you really need to learn some forum etiquettes.

Re: Cannot modify header information - headers already

Posted by: stooo
Posted on: 2006-05-12 09:57:00

Thanks.

We did this yesterday..but it did not help
matters..just moved the error to a differnt line..i'm
not aware of the command you're referring to but will
experiment with it if you can kindly post it.


Re: Cannot modify header information - headers alr

Posted by: guice
Posted on: 2006-05-12 13:54:00

There can't be any spaces of any kind before the first <? if you're attempting to do a header() redirect. Nothing, not a return, space, period, nothing.

The very first two characters in the file MUST be <?.

Re: Cannot modify header information - headers alr

Posted by: gamerhk
Posted on: 2006-05-14 14:48:00

u must have some kind of white space printed out before pushing the header.
try finding out where it is...

if u are lazy..
use ob_start() in the first line of ur php


Tags: php fileheadersblank spacesiniloggingextra