un able to phpbb session login through my own website

Posted by pmms on Stack Overflow See other posts from Stack Overflow or by pmms
Published on 2010-05-22T09:54:19Z Indexed on 2010/05/22 10:01 UTC
Read the original article Hit count: 694

Filed under:
|
|
We are unable to login phpbb through my own site using session. please help us.

<?php session_start();

include "conn.php"; include "PHPBB_Login.php"; echo $_SESSION['username']; $data=mysql_query("select * from people where username='".$_SESSION['username']."'"); $data_data=mysql_fetch_array($data); echo $_SESSION['username']; $_SESSION['username']=$data_data['username']; echo $_SESSION['username']; $phpbbq=mysql_query("select user_id from phpbb_users where username='".$data_data['username']."'"); $phpbbr=mysql_fetch_array($phpbbq); //echo $phpbbr['user_id']; $id=$phpbbr['user_id']; $phpbb->login($id );

class PHPBB_Login {

function PHPBB_Login() {
}

function login($phpbb_user_id) {
$id=$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('./phpBB-3.0.7-PL1/phpBB3/config.php');

    define('IN_PHPBB',true);

    // You may need to change the following line to reflect
    // your phpBB installation.
    $phpbb_root_path = "./phpBB-3.0.7-PL1/phpBB3/";

    require_once( $phpbb_root_path . "extension.inc" );
    require_once( $phpbb_root_path . "common.php" );

   // return session_begin($id,$user_ip, PAGE_INDEX, FALSE, TRUE );
   return  session_begin($id,$user_ip, PAGE_INDEX, FALSE, $autologin, '0');
}

function logout( $session_id, $phpbb_user_id ) {
    global $db, $lang, $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( './phpBB-3.0.7-PL1/phpBB3/config.php' );

    define('IN_PHPBB',true);

    // You may need to change the following line to reflect
    // your phpBB installation.
    $phpbb_root_path = "./phpBB-3.0.7-PL1/phpBB3/";

    require_once( $phpbb_root_path . "extension.inc" );
    require_once( $phpbb_root_path . "common.php" );

    session_end( $session_id, $phpbb_user_id );

    // session_end doesn't seem to get rid of these cookies,
    // so we'll do it here just in to make certain.
    setcookie( $board_config[ "cookie_name" ] . "_sid", "", time() - 3600, " " );
    setcookie( $board_config[ "cookie_name" ] . "_mysql", "", time() - 3600, " " );

}

}

?>

© Stack Overflow or respective owner

Related posts about session

Related posts about website