header problem
| From: | (wujj) | Date: | Mon, 29 Oct 2001 17:45:22 +0000 |
| Subject: | header problem | ||
| Groups: | php.lang | ||
| Request: | Send a blank email to php-lang+get-231@lists.php.net to get a copy of this message | ||
i signed up for a free host which support php,but the server will add a
javascript to my php page,it cause a header error like
Warning: Cannot add header information - headers already sent by (output
started at
/usr/home/hosting/users/phpnewbie/www/phpnewbie.host-ing.com/nntp/thread.php:11)
in
/usr/home/hosting/users/phpnewbie/www/phpnewbie.host-ing.com/nntp/thread.php
on line 1
and the script is:
<script language=javascript>
var url = "http://banner.host-ing.com/content/2";
var domain = "";
var min_timeout = 5;
expired = document.cookie.indexOf("popunder");
var enabled = testCookie()
if (!enabled) {
expired = 0;
}
if (expired == -1) {
setCookie(min_timeout);
popUnder();
}
function setCookie(min_timeout) {
var d = new Date();
var timeout = d.getTime() + (min_timeout * 60 * 1000);
var expires = new Date();
expires.setTime(timeout);
var stamp = d.valueOf();
if (document.domain.indexOf(domain) == -1) {
domain = "";
}if (domain.length > 0 ) {
domain = "domain=." + domain + ";";
}
var expires_str = expires.toGMTString();
var cookie_str = "popunder=" + stamp + ";path=/;"
cookie_str += domain + "expires=" + expires_str;
document.cookie = cookie_str;
}
function testCookie() {
var enabled = navigator.cookieEnabled
if (enabled == null) {
var d = new Date();
var timeout = d.getTime() + (1 * 60 * 1000);
var expires = new Date();
expires.setTime(timeout);
var expires_str = expires.toGMTString();
var test_str = "bluefishCookieTest=" + 1 + ";path=/;"
test_str += domain + "expires=" + expires_str;
document.cookie = test_str;
enabled = document.cookie.indexOf("bluefishCookieTest");
if (enabled == -1) {
return 0;
}
}
else {
if (!enabled) {
return 0;
}
}
return 1;
}
function popUnder() {
var h = 342;
var w = 468;
props = "width=" + w + ",";
props += "height=" + h + ",";
props += "titlebar=0,";
props += "toolbar=0,";
props += "location=0,";
props += "menubar=0,"
props += "scrollbars=0,"
props += "resizable=1,"
props += "channelmode=0,"
props += "directories=0,"
props += "status=0,";
props += "top=9000,left=9000";
var popwin = window.open("","popwin",props,true);
popwin.location = url;
popwin.opener.focus();
}
</script>
so who can tell me how to slove the problem,thanx