Shoutbox

Sick of PHP Error - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Sick of PHP Error (/showthread.php?tid=77019)

Sick of PHP Error by Eddie on 08-26-2007 at 08:34 AM

I am TOTALLY sick of the following php error..

code:
Warning: Cannot modify header information - headers already sent by (output started at /home/haboz/public_html/beta1/beta.php:11) in /home/haboz/public_html/beta1/spotlight/index.php on line 11
Whenever i put PHP into my website it stuffs up and comes up with that error. I dont know why it does it and i have searched google and this forum and found various solutions but i just cant seem to fix the stupid thing...the code that my index page links to is in the attachment.


RE: Sick of PHP Error by NanaFreak on 08-26-2007 at 08:37 AM

code:
header("Content-Type: image/gif");

do you have any text on the page before this?
RE: Sick of PHP Error by Eddie on 08-26-2007 at 08:40 AM

code:
<?php

// Get habbo name

$name = $_GET['Test'];
$name2 = urlencode($name);

$hotel = $_GET['.com.au'];
$hotel2 = urlencode($hotel);

header("Content-Type: image/gif");

thats before what you asked in that file, its in the attachment as you can see ^.^

Ok i uploaded my index page to this post to now.
RE: Sick of PHP Error by Nathan on 08-26-2007 at 09:13 AM

After <?php use ob_start();

and then just before ?> use ob_end_flush();

:)

Without looking at your code I'm guessing you're using a header


RE: Sick of PHP Error by Eddie on 08-26-2007 at 09:58 AM

quote:
Originally posted by Napbree
After <?php use ob_flush();

and then just before ?> use ob_end_flush();

:)
After what one?
RE: Sick of PHP Error by user35870 on 08-26-2007 at 10:05 AM

quote:
Originally posted by Eddie
thats before what you asked in that file, its in the attachment as you can see ^.^

Ok i uploaded my index page to this post to now.

Move
code:
header("Content-Type: image/gif");


Up before any output: html/etc.
RE: Sick of PHP Error by Eddie on 08-26-2007 at 10:07 AM

code:
header("Content-Type: image/gif");
isn't on a page with any html on it, its on its own php document.
RE: RE: Sick of PHP Error by hmaster on 08-26-2007 at 10:10 AM

quote:
Originally posted by Eddie
code:
header("Content-Type: image/gif");
isn't on a page with any html on it, its on its own php document.

Yes but it's included on a page with outputted text?
RE: Sick of PHP Error by Eddie on 08-26-2007 at 10:27 AM

quote:
Originally posted by hmaster
Yes but it's included on a page with outputted text?
The page that the header is on is meant to send an image to the index page yes, here is where it should be...http://www.haboz.net/beta1/beta.php
RE: Sick of PHP Error by hmaster on 08-26-2007 at 11:05 AM

It's because you already have a bit of the page outputted before that page is called, like Napbree said just use ob_*


RE: Sick of PHP Error by Eddie on 08-26-2007 at 11:07 AM

quote:
Originally posted by hmaster
It's because you already have a bit of the page outputted before that page is called, like Napbree said just use ob_*
Yes i will if you would tell me where to put it, there are a few includes and stuff on my site.
RE: Sick of PHP Error by WDZ on 08-26-2007 at 11:08 AM

spotlight/index.php - sends the image
beta.php - the page that the image should be shown on

You can't just include spotlight/index.php in beta.php... you need to use an image tag, silly! :P

code:
<div class="navMAIN" align="center" style="margin-bottom:4px;">Random Habbo</div>
<img src="spotlight/index.php" />
</div>

RE: Sick of PHP Error by Eddie on 08-26-2007 at 11:18 AM

Well that gets rid of the errors, but the image does not come up*-)

When you go to here it says there is an error.


RE: Sick of PHP Error by WDZ on 08-26-2007 at 11:29 AM

You have more unrelated errors in spotlight/index.php...

code:
Warning: imagecreatefromgif(spotlight/spotlight.gif) [function.imagecreatefromgif]: failed to open stream: No such file or directory in /home/haboz/public_html/beta1/spotlight/index.php on line 12

Warning: imagecreatefrompng() [function.imagecreatefrompng]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/haboz/public_html/beta1/spotlight/index.php on line 23

Warning: imagecreatefrompng(http://www.habbo/habbo-imaging/...) [function.imagecreatefrompng]: failed to open stream: Permission denied in /home/haboz/public_html/beta1/spotlight/index.php on line 23

Suggestions...

1. Change imagecreatefromgif("spotlight/spotlight.gif") to imagecreatefromgif("./spotlight.gif")

2. Figure out what this code is for, and fix it: $hotel = $_GET['.com.au'];
RE: Sick of PHP Error by Eddie on 08-26-2007 at 11:43 AM

The second bit there is for the hotel address, if you look just below that in the link it has $hotel there which is why i need the .com.au in there.

Ok i can get the picture to come up, but i dont get all the right stuff lol :P Im getting there now, thank you very much all, especially WDZ :)