TecBrat Posted July 15, 2006 Share Posted July 15, 2006 I am incoporating an existing script into my site. The problem I am having is that their script is sending headers. (My novice skills barely understand what that means.) What I've done is where I usually include my own content, I have an if (!foo='' || !bar=''){ their_code(); } where foo and bar as well as others like them are the variables I found that it uses. Their script had a selection to disable a header warning. I selected that. Then I get to another part of the application that includes an email form. I submit the form, and the email is sent. (I received it) but the page gives a header already sent error. I can supress the error by putting @ in front of the function they use to call their whole program, But any code I put after the dying function is not executed. I tried using or die() and it did not work either. I tried putting ob_flush(); right before their function, but I still got the error. (I had never heard of ob_flush before I read that pinned note.)Any ideas? The only thing I need to do after it dies is give the user a message and send them back to the home page. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted July 15, 2006 Share Posted July 15, 2006 We need to see more code. Ken Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 15, 2006 Share Posted July 15, 2006 what about adding a if statement.//a varable holds data if it's there send them somewere.if($whatever="what_ever") {header("location: whatever.com");} Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 just put the following code at the very top i promise it make the headers work anywhere [code]<?phpob_start();?>[/code] Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 i realize i suggested using output buffering (very unclearly) in my pinned topic, but that DOES NOT FIX THE HABIT THAT FORMS THESE ERRORS.billybob, please stop recommending this as a solution to everyone's header issues.tecbrat: i'd like to start by saying thank you for reading the pinned topic, however unhelpful it is (i posted it a LONG time ago). as ken said, we'd need to see your code to get an idea of how to fix the issue in this instance.. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 15, 2006 Share Posted July 15, 2006 akitchin would a if statement make any diffrence mate. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 it works so just use it and we will have them stoped whinning right? Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 billybob: this forum is NOT about "have them stoped whinning," it's about solving problems, and hopefully in such a way that the problem is avoided in the future. i've edited my pinned topic to be clearer and more descriptive. read it again and maybe you won't have to use ob_start() in the future yourself.redarrow: i'm not sure he's in a spot to know where to put that if(), and whether it would work. we need to see more code to know what he's dealing with. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 15, 2006 Share Posted July 15, 2006 akitchin i read the new post thanks very nice cheers. Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 15, 2006 Share Posted July 15, 2006 Post the code and we'll see if anything is being output before the new headers. Quote Link to comment Share on other sites More sharing options...
TecBrat Posted July 15, 2006 Author Share Posted July 15, 2006 WOW! That was a lot of replies in a hurry.This worked. I found a solution that did not send another header.Most of my problems stem from using other people's code, and not knowing what they were doing.[code] ?> <meta http-equiv="refresh" content="0; url=<?echo($url);?>"> <? //header('Location: ' . $url);[/code] Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 um i use cookies for login and thats how to set them up how do u make the user stay loged in Quote Link to comment Share on other sites More sharing options...
pixy Posted July 15, 2006 Share Posted July 15, 2006 [quote author=BillyBoB link=topic=100621.msg397383#msg397383 date=1152924622]just put the following code at the very top i promise it make the headers work anywhere [code]<?phpob_start();?>[/code][/quote] Lol, it makes me laugh that you always suggest output buffering and everyone says not to use it. XD Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 billybob, what are you talking about? Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 15, 2006 Share Posted July 15, 2006 im saying how do u make the user loginso that u dont have to use the dredful ob_start(); Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 read my pinned topic, it has been changed to be clearer. if you still have troubles understanding, post a new topic. Quote Link to comment Share on other sites More sharing options...
pixy Posted July 15, 2006 Share Posted July 15, 2006 [quote author=BillyBoB link=topic=100621.msg397498#msg397498 date=1152934020]im saying how do u make the user loginso that u dont have to use the dredful ob_start();[/quote]Just put session_start(); at the top of the page. Ditch the cookies, and use sessions. They're more secure anyways. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.