site integration

Discussion forum for MOD Writers regarding MOD Development.
Locked
cezor
Registered User
Posts: 2
Joined: Mon Apr 16, 2012 11:14 am

site integration

Post by cezor »

Greetings,

Im trying to intergrade phpbb with my website, but my sessions seems to be destroyed the minute I redirect.

This is what i got so far.

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = 'forum/';  // Your path here
    $phpEx = "php";
    include($phpbb_root_path . 'config.' . $phpEx);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    if(isset($_GET["p"]) && $_GET["p"]=="login"){
        $result=$auth->login("username", "123456");

        if ($result['status'] == LOGIN_SUCCESS) {

            echo "You're logged in";

            header("location: test.php?p=test");

        } else {

            echo $user->lang[$result['error_msg']];

        }

    }

    if(isset($_GET["p"]) && $_GET["p"]=="test"){
        $user->session_begin();
        $auth->acl($user->data);
        $user->setup();
        if($user->data['is_registered']){
            echo "logged in!";
        }
        else{
            echo "not logged in!";
        }
    }
    ?>
Last edited by tbackoff on Mon Apr 16, 2012 5:48 pm, edited 1 time in total.
Reason: moved to MOD Writers Discussion

_ollie_
Registered User
Posts: 654
Joined: Wed May 25, 2005 7:27 pm
Location: Berkshire
Contact:

Re: site integration

Post by _ollie_ »

Without knowing exactly what you are doing it's hard to judge, but I found this article on the Knowledge Base useful when I first started looking at integrating my site with phpBB.

Add a New Custom Page to phpBB

cezor
Registered User
Posts: 2
Joined: Mon Apr 16, 2012 11:14 am

Re: site integration

Post by cezor »

Im trying to stay loged in after i redirect to ?p=test.
But it's like $user->data gets reset

User avatar
eeji
Jr. Style Validator
Posts: 1189
Joined: Fri Dec 12, 2008 9:08 pm
Location: Manchester, UK
Contact:

Re: site integration

Post by eeji »

you need to pass the session id in the url otherwise you get logged out
My phpBB styles: phpbbstyles.oo.gd
My board: iansvivarium.com

Locked

Return to “[3.0.x] MOD Writers Discussion”