Jump to content

[SOLVED] Headers Error - I Know About The Posted Topic Above


fanfavorite

Recommended Posts

Hey Everyone,

 

The header is already sent error is driving me crazy.  I must be doing something else wrong.  I have eliminated all white space, even in code like below:

 

Members Page:

<?include('login/membersverify.php')?>

 

membersverify.php: 

<?header ("location:http://www.mydomainname.com/cms/login/index.php")?>

 

No spaces before and after, no other code at all, but still get the header error. 

 

Both that and my other code don't seem to work:

 

<?

session_start();

include ('../login/membersconfig.php');

include ('functions.php');

 

if ($_GET['domain'] != ""){

$ftp = $_GET['domain'];

session_register("ftp");

}

?>

 

 

The weird thing is, a code like below works:

<?

 

if ($_GET['logout'])

{

setcookie("login");

}

if ($_POST[loginaccount])

{

include ('membersconfig.php');

$q = mysql_query("select * from Login WHERE Username = '$_POST[username]';");

while($f=mysql_fetch_array($q))

{

$c = "$f[username]";

if ($_POST[password] == $f[Password] AND $_POST[password] != "")

{

setcookie("login",$c,false,"/",false);

header("Location: ../index.php");

}

else

{

$error = "Invalid username and/or password.  Please try again.";

include ('membersloginform.php');

}

die;

  }

$error = "Invalid username and/or password.  Please try again.";

include ('membersloginform.php');

}

else

{

include ('membersloginform.php');

die;

}

?>

 

I am losing my mind trying to figure out what might be the problem.  I have even tried using the buffer, but doesn't seem to do anything.  Maybe I am using it wrong.  Any help would be appreciated.  Thanks!

 

-JC

For the File:

 

members.php

line 1:  <?include('login/membersverify.php')?>

 

login/membersverify.php

line 1:  <?header ("location:http://www.mydomainname.com/cms/login/index.php")?>

 

Error:

Warning: Cannot modify header information - headers already sent by (output started at /home/USER/public_html/login/membersverify.php:1) in /home/USER/public_html/login/membersverify.php on line 1

 

I am using Notepad to edit.  I have read some where that Notepad adds BOM characteristics that could throw off some servers, however I have downloaded some other editors and don't see those characters.

 

Well according to your script, the output started in membersverify.php on line 1.  That means there must be some sort of character before the opening <?php tag.  Try using something such as dreamweaver or a free PHP editing software.  Don't open your previous file in the editor, but rather create a new file and remake your script.

 

http://lists.xml.org/archives/xml-dev/200106/msg00389.html

Microsoft Notepad saves a BOM at the start of a UTF-8 file (as someone else points out in another post).

Yeah I believe that was the issue.  I decided to just add all my design elements into the site now and fix the error later and it seemed to fix the issue.  So I assume it was the BOM issue.  Thanks everyone for all the help. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.