PHP Classes

File: PHPBB_Examples.php

Recommend this page to a friend!
  Classes of Duncan Gough   PHPBB Login Integration   PHPBB_Examples.php   Download  
File: PHPBB_Examples.php
Role: Example script
Content type: text/plain
Description: Some PHPBB_Login examples
Class: PHPBB Login Integration
Authenticate PHPBB users with site login system
Author: By
Last change:
Date: 19 years ago
Size: 1,693 bytes


Class file image Download

 * These examples show you how to integrate the phpBB
 * login in and authentication system with your website.
 * Since we quite like our login system and it's proven
 * itself to be very extensible, we don't want to replace
 * but we do want to have a universal login system for
 * both our website *and* the forum.
 * To take full advantage of this PHPBB_Login class you'll
 * need to modify your own login system to include a call
 * to the relevant login or logout methods.
 * This way, you can handle all of the website login as normal,
 * and also log the user into phpBB in the same step.
 * This system is reliant on the website username being exactly
 * the same as the phpBB username. To insure this, I recommend
 * disabling the ability to change usernames from within the
 * phpBB admin control panel.
 * Distributed under the LGPL license:
 * Duncan Gough
 * Home
 * Work
 * Play!

/* Example 1: Logging in */


/* First, login the user using your own login system, for example; */
$user = new User();

// username and password are implied here,
// they will most likely be form variables
$user->login( $username, $password );

// Then login the user to the forum
$phpBB = new PHPBB_Login();

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

/* Example 2: Logging out */


$user = new User();

/* First, logout the user from the forum */
$phpBB = new PHPBB_Login();

$phpbb->logout( session_id(), $user->id) ;

/* Then logout the user from your own login system */
$user->logout( $user->id );