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
https://forums.phpfreaks.com/topic/57104-explanation-of-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.