开发者

phpBB3 auto-login

开发者 https://www.devze.com 2023-02-13 11:09 出处:网络
I\'ve integrated a phpbb3 forum to my already existing website. I\'ve been able to make my registration process add the user to the phpbb db as well.

I've integrated a phpbb3 forum to my already existing website.

I've been able to make my registration process add the user to the phpbb db as well.

Now i'm facing a problem where I am trying to get the user to auto-login to the fo开发者_如何学Gorum when he logs in to my website.

Have anyone here done that? I can't find anything relevant on Google as all posts seem to talk about 'phpbb external webpages' and how you can use phpbb sessions on other webpages. however what i'm trying to do is to initiate a login only when the member logs in to my website, and following the tutorials i found on google will let my users log in to my site when they log in to my forum (which is the other way around).

Thanks


<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = '../phpBB3/'; //the path to your phpbb relative to this script
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include("../phpBB3/common.php"); ////the path to your phpbb relative to this script
    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    $username = request_var('username', 'john');
    $password = request_var('password', '123');

    if(isset($username) && isset($password))
    {
      $result=$auth->login($username, $password, true);
      if ($result['status'] == LOGIN_SUCCESS) {
        echo "You're logged in";
      } else {
        echo $user->lang[$result['error_msg']];
      }
    }
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号