Jump to content

Explanation of code?


Solarpitch

Recommended Posts

Hey,

 

Not having the best day trying to integrate my login with phpbb's one.... but I'll hack on anyway!

 

Kinda just looking for an explanation of this code if possible. The following code...

 

Code to call in my logon. This sets the phpbb session...

 

 

 

require 'PHPBB_Login.php';

 

**************

 

$user = new User();

 

$user->login( $nme, $pass );

 

$phpBB = new PHPBB_Login();

 

$phpbb->login( $user->id ); ----- line 79

 

 

 

PHPBB_Login.php - code that does the hard part

 

class PHPBB_Login {

    function PHPBB_Login() {
    }

    function login( $phpbb_user_id ) {
        global $db, $board_config;
        global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
    
        // Setup the phpbb environment and then
        // run through the phpbb login process

        // You may need to change the following line to reflect
        // your phpBB installation.
        require_once( './forum/config.php' );
    
        define('IN_PHPBB',true);

        // You may need to change the following line to reflect
        // your phpBB installation.
        $phpbb_root_path = "./forum/";
        
        require_once( $phpbb_root_path . "extension.inc" );
        require_once( $phpbb_root_path . "common.php" );

        return session_begin( $phpbb_user_id, $user_ip, PAGE_INDEX, FALSE, TRUE );
    
    }
}

 

Basically the code in Blue.. I kinda know what its doing but how could I do the same thing if I wasnt using a class to login a user? ie $user = new User();

 

At the moment I keep getting Call to a member function login() on a non-object ... line 79

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.