PDA

View Full Version : global.php include


t0ny
12-11-2005, 11:18 AM
I have a file outside of vb with the following code:

<?php
//Store current directory
$cwd = getcwd();
echo getcwd().'\n';
//change to forum directory
chdir ('../forum');
echo getcwd() . '\n';

require_once('global.php');
if ($vbulletin->userinfo['userid'])
{
echo 'Welcome ' . $vbulletin->userinfo['username'] . ', you have logged in.';
}
else
{
echo 'Not logged in...';
}
//return to original directory
chdir ($cwd);
echo getcwd().'\n';
?>

I am getting this error when I use it :

Unable to add cookies, header already sent.

Can anyone help??

akanevsky
12-11-2005, 11:23 AM
That is because you cannot have any HTML output before the headers (cookies) are defined. E.g., no output before global.php is included.

t0ny
12-11-2005, 11:24 AM
Ahh, thank you so much!!!
ASP coder i am afraid...