In top of my index I include funcs.php which is :
then later at the index I include basket.php which calls GetCartId() and the explorer shows the message
"Cannot modify header information - headers already sent by (output started at /var/www/html/generalm/demo/index.php:31) in /var/www/html/generalm/demo/nimda/funcs.php on line 22"
any help?
PS before including the funcs.php I have sesion_start()
Code:
<?php
function GetCartId()
{
//if user logged on use username as identification, else use coockie for anonymous user
if ($_SESSION['loggedon']==1)
{
$a=$_SESSION['username'];
}
else
{
// This part generates an encrypted string and will set it as a cookie using set_cookie. This will also be used as the cookieId //field in the cart table
if(isset($_COOKIE["cartId"]))
{
return $_COOKIE["cartId"];
}
else
{
// There is no cookie set. We will set the cookie
// and return the value of the users session ID
session_start();
setcookie("cartId", session_id(), time() + ((3600 * 24) * 30));
$a=session_id();
}
}
return $a;
}
function mssql_sec($a)
{
$a=str_replace("'","''",$a);
$a=str_replace(";","",$a);
return $a;
}
function mssql_sec2($a)
{
$a=str_replace("'","''",$a);
//$a=str_replace(";","",$a);
return $a;
}
?>
"Cannot modify header information - headers already sent by (output started at /var/www/html/generalm/demo/index.php:31) in /var/www/html/generalm/demo/nimda/funcs.php on line 22"
any help?
PS before including the funcs.php I have sesion_start()
Comment