views:

54

answers:

2

I am trying to integrate my login system made with PHP with the PHPBB Login system. My problem is that I am including the PHP login document which contains a class called $user but my login system uses $user as well. e.g My function for login is executing inside a class called $user and the phpbb login class is $user->login

Is it possible to load the phpbb document, and login in a separate kind of "environment" to my main website?

If you need any more info just let me know

+2  A: 

You could run your code in a function. Functions aren't passed global variables if you don't explicitly tell them ;)

nikic
A class cannot start with a `$`! You are dealing with an *instance* of a class and this instance may be created and used in another scope - function scope.
nikic
A: 

Can you not change the variable?

Such as

<?php
    include 'the/phpbb/core.pohp';

    $phpbb_user = $user;

    include 'my/login.pohp';

    if($user->valid_uid($phpbb_user->uid))
    {
    }
?>

edits:

Can you add a second variable

Open common.php and find the following:

$user  = new user();

add After

$backup_user  = $user;
RobertPitt
Check my update !
RobertPitt
you can create a static class to set/get objects, the static class would have a global scope for access but the objects stored inside them will be bound to the class scope.
RobertPitt