fanfavorite Posted April 22, 2007 Share Posted April 22, 2007 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 Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/ Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 try this <?php $q = mysql_query("select * from Login WHERE Username = '.$_POST[username].'")or die ("Error in query" . mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235204 Share on other sites More sharing options...
Glyde Posted April 22, 2007 Share Posted April 22, 2007 The header error that you are receiving will tell you exactly what line in what file contains the error. Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235205 Share on other sites More sharing options...
fanfavorite Posted April 22, 2007 Author Share Posted April 22, 2007 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. Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235209 Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 if this is a direct copy of your login/membersverify.php <?header ("location:http://www.mydomainname.com/cms/login/index.php")?> try removing the space between the word header and the opening parentheses Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235213 Share on other sites More sharing options...
fanfavorite Posted April 22, 2007 Author Share Posted April 22, 2007 Yeah, I noticed that when I posted, but still no go. Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235223 Share on other sites More sharing options...
Glyde Posted April 22, 2007 Share Posted April 22, 2007 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). Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235251 Share on other sites More sharing options...
fanfavorite Posted April 22, 2007 Author Share Posted April 22, 2007 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. Link to comment https://forums.phpfreaks.com/topic/48129-solved-headers-error-i-know-about-the-posted-topic-above/#findComment-235277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.