cannot redeclare function??

They have: 164 posts

Joined: Nov 2001

i have these few lines in my code:

<?php
chdir
($DOCUMENT_ROOT . \"/forum\");
require_once(
$DOCUMENT_ROOT . \"/forum/global.php\");

    if (
$bbuserinfo[userid]==0)
    {
       
       
$thispage=urlencode(\"$PHP_SELF\");
        header(\"Location:<a href=\"http://www.certifyexpress.com/forum/usercp.php?urloverride=1&prevpage=\" target=\"_blank\"><a href=\"http://www.certifyexpress.com/forum...ide=1&prevpage=\" class=\"bb-url\">http://www.certifyexpress.com/forum...ide=1&prevpage=</a></a>\".
$thispage);

    }
?>

everything seems to work well until i include this line:

<?php
require(\"../template/phpheader/header.php\");
?>

and i got this error:

Fatal error: Cannot redeclare stripslashesarray() in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php on line 11
'

what can i do??

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

try require_once() instead of require()

They have: 164 posts

Joined: Nov 2001

if i put my code like this:

<?php
chdir
($DOCUMENT_ROOT . \"/forum\");
require_once(
$DOCUMENT_ROOT . \"/forum/global.php\");

    if (
$bbuserinfo[userid]==0)
    {
       
       
$thispage=urlencode(\"$PHP_SELF\");
        header(\"Location:<a href=\"http://www.certifyexpress.com/forum/usercp.php?urloverride=1&prevpage=\" class=\"bb-url\">http://www.certifyexpress.com/forum/usercp.php?urloverride=1&prevpage=</a>\".
$thispage);

    }
include_once(\"../template/phpheader/header.php\");
?>

it will check whether i'm login or not, bring me to the login page and then bring me back to the page where i first in and i got this error:

Fatal error: Cannot redeclare stripslashesarray() in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php on line 11
'

and if i put my code like this:

<?php
include_once(\"../template/phpheader/header.php\");
chdir(
$DOCUMENT_ROOT . \"/forum\");
require_once(
$DOCUMENT_ROOT . \"/forum/global.php\");

    if (
$bbuserinfo[userid]==0)
    {
       
       
$thispage=urlencode(\"$PHP_SELF\");
        header(\"Location:<a href=\"http://www.certifyexpress.com/forum/usercp.php?urloverride=1&prevpage=\" class=\"bb-url\">http://www.certifyexpress.com/forum/usercp.php?urloverride=1&prevpage=</a>\".
$thispage);

    }
?>

it will not check whether i'm login ornot, straight away prompt me an error.....says cannot add header.....

wat can i do??

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I'm guessing that header.php is also requiring global.php, and so, redeclaring stripslashesarray(). Is this right?

Is global.php from vBulletin? I'm not too keen on editing their source as I'm not very familiar with it. If header.php is including global.php, make sure it's using require_once().

The cannot add header error is because something has been printed to standard out (client's browser).

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.