Ok I have a small script that just allows you to login, register, and log out from a little Welcome message on my page, heres the error message I get:
Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site20/fst/var/www/html/members/index3.php:11) in /home/virtual/site20/fst/var/www/html/members/admin/functions.php on line 1611
Heres the area of the code:
// ###################### Start vbsetcookie #######################
function vbsetcookie($name,$value="",$permanent=1) {
global $cookiepath,$cookiedomain, $SERVER_PORT;
if ($permanent) {
$expire=time() + 60*60*24*365;
} else {
$expire = 0;
}
if ($SERVER_PORT == "443") {
// we're using SSL
$secure = 1;
} else {
$secure = 0;
}
if (defined('USE_COOKIE_WORKAROUND')) {
// It's been reported that there's a bug in PHP 4.2.0/4.2.1 with Apache 2 causing setcookie() to not work correctly.
// This is the workaround. If you need to use this code, please add:
// define('USE_COOKIE_WORKAROUND', 1);
// to your config.php.
if (!$value) {
// need to do this so IE deletes the cookie correctly
$expire = time() - 31536001;
$value = 'deleted';
}
$cookieheader = "Set-Cookie: $name=".urlencode($value);
if ($expire) {
$cookieheader .= '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT';
}
if ($cookiepath) {
$cookieheader .= "; path=$cookiepath";
}
if ($cookiedomain) {
$cookieheader .= "; domain=$cookiedomain";
}
if ($secure) {
$cookieheader .= '; secure';
}
header($cookieheader, false); // force multiple headers of same type
} else {
setcookie($name, $value, $expire, $cookiepath, $cookiedomain, $secure);
}
}
line 1611 is
setcookie($name, $value, $expire, $cookiepath, $cookiedomain, $secure);
Whats the problem?