nirvana43
07-06-2009, 02:54 AM
Hello
I've created 1 custom page by referring to vBulletin API Basics topic posted by Psionic Vision.
Here is topic url : https://vborg.vbsupport.ru/showthread.php?t=98009
I'm getting following error :confused: :
Unable to add cookies, header already sent.
File: /home2/aditya43/public_html/forums/test.php
Line: 1
My test.php file contains following code :
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'adi');
$globaltemplates = array('adi');
require('./global.php');
include('aaa/tmp.php');
$navbits = array();
$navbits[$parent] = 'Aditya Test Page';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
}
else
{
eval('print_output("' . fetch_template('adi') . '");');
}
?>
My template "adi" under vbulletin contains following code :
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<if condition="$adiinitcond">
$testcond1
<else/>
$testcond2
</if>
</table>
$footer
</body>
</html>
tmp.php file contains :
$a=5;
$b=6;
$adiinitcond="$a>$b";
$testcond1="$a is bigger";
$testcond2="$b is bigger";
However if i login to vbulletin forum and then access test.php, it works perfect. But as a guest it gives me above error.
I also wanna allow guests on test.php or at least it should print vbulletin error message.
Here is what i've done so far to get rid of above error :
1. Removed all whitespace etc.
2. Tried "<?php" tag without closing php tag "?>"
3. Tested after removing "include('aaa/tmp.php');" from test.php
4. Removed all "echo", "print" etc. from tmp.php
The possible cause of above error is i'm trying to send data or something to browser before vbulletin cookies. So i traced my entire code and found i'm not sending anything to browser before cookies (or am i?).
I've created 1 custom page by referring to vBulletin API Basics topic posted by Psionic Vision.
Here is topic url : https://vborg.vbsupport.ru/showthread.php?t=98009
I'm getting following error :confused: :
Unable to add cookies, header already sent.
File: /home2/aditya43/public_html/forums/test.php
Line: 1
My test.php file contains following code :
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'adi');
$globaltemplates = array('adi');
require('./global.php');
include('aaa/tmp.php');
$navbits = array();
$navbits[$parent] = 'Aditya Test Page';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
}
else
{
eval('print_output("' . fetch_template('adi') . '");');
}
?>
My template "adi" under vbulletin contains following code :
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<if condition="$adiinitcond">
$testcond1
<else/>
$testcond2
</if>
</table>
$footer
</body>
</html>
tmp.php file contains :
$a=5;
$b=6;
$adiinitcond="$a>$b";
$testcond1="$a is bigger";
$testcond2="$b is bigger";
However if i login to vbulletin forum and then access test.php, it works perfect. But as a guest it gives me above error.
I also wanna allow guests on test.php or at least it should print vbulletin error message.
Here is what i've done so far to get rid of above error :
1. Removed all whitespace etc.
2. Tried "<?php" tag without closing php tag "?>"
3. Tested after removing "include('aaa/tmp.php');" from test.php
4. Removed all "echo", "print" etc. from tmp.php
The possible cause of above error is i'm trying to send data or something to browser before vbulletin cookies. So i traced my entire code and found i'm not sending anything to browser before cookies (or am i?).