Hi, I'm trying to integrate a phpBB forum into my existing user database and login, I'm not too familiar with how phpBB is coded so help would be good. I just need it too use the current users in the database and use the login cookies saved from the sites main login. If theres a charge for doing such a task then let me know, Thanks -Dan
Try this: class PHPBB_Login { function PHPBB_Login() { } function login( $phpbb_user_id ) { global $db, $board_config; global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID; require_once( './forum/config.php' ); define('IN_PHPBB',true); $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 ); } function logout( $session_id, $phpbb_user_id ) { global $db, $lang, $board_config; global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID; require_once( './forum/config.php' ); define('IN_PHPBB',true); $phpbb_root_path = "./forum/"; require_once( $phpbb_root_path . "extension.inc" ); require_once( $phpbb_root_path . "common.php" ); session_end( $session_id, $phpbb_user_id ); setcookie( $board_config[ "cookie_name" ] . "_sid", "", time() - 3600, " " ); setcookie( $board_config[ "cookie_name" ] . "_mysql", "", time() - 3600, " " ); } } ?> PHP: Sessions: function addPHPBBSessionInfo($session_id, $session_user_id, $session_start, $session_time, $session_ip, $session_logged_in) { $session_ip = $this->encode_ip($session_ip); $session_time = time(); $q = "INSERT INTO phpbb_database_name.phpbb_sessions VALUES ('$session_id', $session_user_id, $session_start, $session_time, '$session_ip', 0, $session_logged_in, 0)"; return mysql_query($q, $this->connection); } PHP: Encode_IP(): function encode_ip($dotquad_ip) { $ip_sep = explode('.', $dotquad_ip); return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]); } PHP: Call inside session class: $database->addPHPBBSessionInfo($_SESSION['sid'], $this->phpbb_user_id, $this->time, $this->time, $_SERVER['REMOTE_ADDR'], $this->logged_in); PHP:
Well my site has premade functions to see if a user is logged in or not, would there be a simple way to just use the current functions within the phpbb functions? Once again if anyone has good experience with this then i'll pay for it to be done, thanks.