Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website Design Forum


You are currently viewing our Website Design Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Anyone know what's wrong here?
Old 01-01-2007, 09:44 PM Anyone know what's wrong here?
DLGx's Avatar
Bleah

Posts: 180
Trades: 0
On one of my computers there are no errors on http://www.zoodu.com/ but on the other there is

Warning: Cannot modify header information - headers already sent by (output started at /data/www/sites/www.zoodu.com/html/index.php:6) in /data/www/sites/www.zoodu.com/html/468by60H.php on line 12

printed out in the header.

When asking others to test some get the error, some don't, and I'm clueless.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
DLGx is offline
Reply With Quote
View Public Profile Visit DLGx's homepage!
 
 
Register now for full access!
Old 01-01-2007, 09:51 PM
Junior Talker

Posts: 20
Trades: 0
Well I don't have a clue why it would do that, but it doesn't do it for me. I am viewing it in Firefox.

EDIT: When I clicked around the site, after a few pages I started to recieve the error .\

EDIT 2: I was just randomly reading around and your website said:
Quote:
Originally Posted by Zoodu
Step 1: Copy the code using ctrl+c or mouse right click and "copy".
Step 2: Login to your profile and click on "Edit Profile".
Step 3: Paste the copied code into the appropriate section, usually "About Me", using ctrl+p or mouse right click and paste.
I think you meant to type ctrl+v :P
Chasby is offline
Reply With Quote
View Public Profile
 
Old 01-01-2007, 10:03 PM
DLGx's Avatar
Bleah

Posts: 180
Trades: 0
Amazing how many useless proof readers I've got....thanks

And it looks like this code works, at least I don't get errors on my other computer:

Code:
<?php
include("/var/www/sites/www.zoodu.com/html/geoip.inc");
$gi = geoip_open("/var/www/sites/www.zoodu.com/html/GeoIP.dat",GEOIP_STANDARD);
$country = geoip_country_code_by_addr($gi, $REMOTE_ADDR);
geoip_close($gi);
?>
while this code, which I need to run since the above one uses way more bandwidth and server resources, produces the error on random or something:

Code:
<?php
if (isset($_COOKIE["geo"])){
    $country = $_COOKIE['geo'];
}
else {
    include("/var/www/sites/www.zoodu.com/html/geoip.inc");
    $gi = geoip_open("/var/www/sites/www.zoodu.com/html/GeoIP.dat",GEOIP_STANDARD);
    $ip = $_SERVER["REMOTE_ADDR"];
    $country = geoip_country_code_by_addr($gi, $ip);
    geoip_close($gi);
    setcookie("geo", $country, time()+15552000, "/", ".zoodu.com", 0); //6 month cookie
}
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
DLGx is offline
Reply With Quote
View Public Profile Visit DLGx's homepage!
 
Old 01-01-2007, 10:41 PM
Junior Talker

Posts: 20
Trades: 0
No problem about finding the error. I kinda have a knack for it. I am 15 and my mom brought home some special invitation for her work clients that she had proof-read by 5 "proof readers", nobody seemed to notice how business was spelled busines on the front of the invitation.

As for fixing the header, good luck fixing it. I am the wrong person to ask about that :P
Chasby is offline
Reply With Quote
View Public Profile
 
Old 01-01-2007, 11:40 PM
Ultra Talker

Posts: 407
Trades: 1
Quote:
Originally Posted by DLGx View Post
On one of my computers there are no errors on http://www.zoodu.com/ but on the other there is

Warning: Cannot modify header information - headers already sent by (output started at /data/www/sites/www.zoodu.com/html/index.php:6) in /data/www/sites/www.zoodu.com/html/468by60H.php on line 12

printed out in the header.

When asking others to test some get the error, some don't, and I'm clueless.
DLGx, the problem is that the file "/html/468by60H.php" is trying to send a header but content has already been sent to the browser. Headers must be sent before any actual content. I went to www.zoodu.com/html/468by60H.php and noticed that the file was non-existant so I am guessing that if you put an actual banner there, the problem will disappear as the missing page tries to redirect to the error page. Otherwise try output buffering.

If you want some help, give me a shout on MSN.

Edit: I just read your second post in this thread. The problem with the second script is that it's trying to set a cookie when HTML has already been sent.
__________________
[
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
]
Lucas3677 is offline
Reply With Quote
View Public Profile Visit Lucas3677's homepage!
 
Old 01-02-2007, 05:27 AM
DLGx's Avatar
Bleah

Posts: 180
Trades: 0
so the script has to be in or above the <head> tag?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
DLGx is offline
Reply With Quote
View Public Profile Visit DLGx's homepage!
 
Old 01-02-2007, 01:03 PM
Ultra Talker

Posts: 407
Trades: 1
Not exactly. This is what the server sends to the browser:

Code:
SomeHeader: Some value
Cookie: asdf=werqwe; qwerqwe=wtiuhgsa
Otherstuff: asdfasdf
YetAnotherHeader: value

<html>
   <head>
     ...
   </body>
</html>
Notice how all the headers are grouped together. So once the HTML starts being outputted, no more headers can be sent (therefore no cookies or server redirects can be sent either).

Therefore, what you need to do is just make sure the geo-checker script runs at the very beginning of the PHP script, before any output is sent to the browser.
__________________
[
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
]
Lucas3677 is offline
Reply With Quote
View Public Profile Visit Lucas3677's homepage!
 
Old 01-02-2007, 04:24 PM
DLGx's Avatar
Bleah

Posts: 180
Trades: 0
Well basically that means it needs to run at the top of the file?

Which is much easier said than done with this website....
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
DLGx is offline
Reply With Quote
View Public Profile Visit DLGx's homepage!
 
Old 01-02-2007, 05:02 PM
Ultra Talker

Posts: 407
Trades: 1
Try replacing the setcookie() line with this code:

Code:
echo <<< JSC
<script>
var exdate = new Date();
exdate.setDate(exdate.getDate() + 30*6);
document.cookie = "geo={$country}; expires=" + exdate.toGMTString();
</script>
JSC;
The cookie will be set client-side that way.
__________________
[
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
]
Lucas3677 is offline
Reply With Quote
View Public Profile Visit Lucas3677's homepage!
 
Old 01-02-2007, 09:16 PM
NavySeals91's Avatar
$100 - $999 Monthly

Posts: 156
Trades: 0
Nice design DLGx, I get no error now.
__________________

Please login or register to view this content. Registration is FREE
NavySeals91 is offline
Reply With Quote
View Public Profile
 
Old 01-02-2007, 09:31 PM
Junior Talker

Posts: 20
Trades: 0
Same here, no error.
Chasby is offline
Reply With Quote
View Public Profile
 
Old 01-03-2007, 06:13 AM
DLGx's Avatar
Bleah

Posts: 180
Trades: 0
Yeah the javascript thing seems to have sorted it out Lucas, and thanks Navy.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
DLGx is offline
Reply With Quote
View Public Profile Visit DLGx's homepage!
 
Reply     « Reply to Anyone know what's wrong here?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32825 seconds with 12 queries