Jump to content

I did read the pinned note about headers, but...


TecBrat

Recommended Posts

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.
Link to comment
Share on other sites

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..
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

[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]
<?php
ob_start();
?>
[/code]
[/quote] Lol, it makes me laugh that you always suggest output buffering and everyone says not to use it. XD
Link to comment
Share on other sites

[quote author=BillyBoB link=topic=100621.msg397498#msg397498 date=1152934020]
im saying how do u make the user login

so 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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.