如何将用户登录从我的网站集成到phpBB?

时间:2021-08-14 09:47:57

I need some help with what is probably a newbie question in terms of modifying phpBB.

在修改phpBB方面,我需要一些可能是新手问题的帮助。

I have a whole system developed in PHP, and I would like to integrate phpBB so that people can navigate into the forums and post seamlessly, without logging in again.

我有一个用PHP开发的整个系统,我想整合phpBB,以便人们可以导航到论坛并无缝发布,而无需再次登录。

Now, using the phpBB users table as the users table for my system (and having people register in phpBB instead of in my website) is not possible unfortunately (it'd take more work to redo our system than to build our own basic forum).
I'm assuming I can hack my way into making phpBB believe that a certain user ID has logged in, however, that user won't exist in phpBB's users table (which I'm assuming will cause it to error out pretty much everywhere).

现在,使用phpBB用户表作为我的系统的用户表(并且让人们在phpBB而不是在我的网站中注册)是不可能的(重做我们的系统需要做更多的工作而不是建立我们自己的基本论坛) 。我假设我可以破解我的方式让phpBB相信某个用户ID已登录,但是,该用户将不会存在于phpBB的用户表中(我假设它会导致它几乎无处不在) 。

All the tutorials and forum posts I could find implied having phpBB as the primary. I couldn't find anything to do it the other way around.

我能找到的所有教程和论坛帖子都暗示以phpBB为主要内容。我找不到任何相反的方法。

I'm guessing the only possible way to solve this is by having both tables relatively synchronized.

我猜测解决这个问题的唯一可行方法是让两个表相对同步。

Now, provided that I can have both users table synchronized, what is the best way to integrate both sites, keeping my site's login and users table as the "primary" ones?
Also, is there anything in particular I should keep in mind when creating records in phpBB's users table? Or is it relatively straightforward to figure out? What tables should I be writing to, if there is more than one?

现在,只要我可以让两个用户表同步,集成两个站点的最佳方法是什么,将我的站点的登录和用户表保持为“主要”?另外,在phpBB的用户表中创建记录时,有什么特别要注意的吗?或者弄清楚它是否相对简单?如果有多个表,我应该写什么表?

4 个解决方案

#1


11  

This is an old question so I'm sure you've worked something out by now, but if you need to refactor things in the future, this is entirely possible with authentication plugins in phpBB3:

这是一个老问题,所以我确定你现在已经解决了一些问题,但是如果你将来需要重构一些东西,这完全可以通过phpBB3中的身份验证插件完成:

http://wiki.phpbb.com/Authentication_plugins

I'm working on one now where phpBB is the "secondary" system, and it's going pretty well.

我正在开发一个现在phpBB是“辅助”系统的地方,并且它进展顺利。

#2


7  

I just worked on this task today, after some investigation implemented an Authentication plugin Here is a good example Getting phpBB to accept Django sessions

我刚刚完成了这项任务,经过一些调查后实现了一个身份验证插件这是一个很好的例子让phpBB接受Django会话

#3


6  

I have integrated phpBB with a site before, however I used phpBB's login system/users table as the primary one as you said. Since phpBB is a pretty advanced forum software, it would be a pretty time consuming project to change its user and login system completely.

之前我已经将phpBB与一个站点集成,但是我使用phpBB的登录系统/用户表作为主要的一个,如你所说。由于phpBB是一个非常先进的论坛软件,完全改变其用户和登录系统将是一个非常耗时的项目。

When I had to use the site's login as the primary one, I used PunBB. It was way simpler to modify PunBB.

当我不得不使用网站的登录作为主要登录时,我使用了PunBB。修改PunBB简单得多。

If you absolutely have to use your own login as primary, and phpBB, then I agree with you in that the easiest way would be to keep the tables synchronized, and call both the login scripts when somebody logs in.

如果你绝对必须使用你自己的登录作为主要和phpBB,那么我同意你的看法,最简单的方法是保持表同步,并在有人登录时调用两个登录脚本。

When you're inserting data into phpBB, the users table is pretty straightforward. Each entry has the basic info for a user, and if you have custom fields for the user profiles, they go into the profile_fields and profile_fields_data tables.

当您将数据插入phpBB时,users表非常简单。每个条目都有用户的基本信息,如果您有用户配置文件的自定义字段,则会进入profile_fields和profile_fields_data表。

One tricky thing is how phpBB encrypts user passwords. I think you have to use phpBB's function called phpbb_hash($password) to do that. It's declared in the file phpbb/includes/functions.php

一个棘手的问题是phpBB如何加密用户密码。我认为你必须使用phpBB的函数phpbb_hash($ password)来做到这一点。它在文件phpbb / includes / functions.php中声明

For the phpBB login code, see funciton login_box in file phpbb/includes/functions.php

有关phpBB登录代码,请参阅文件phpbb / includes / functions.php中的funciton login_box

#4


2  

You can use the below to login into phpBB:

您可以使用以下登录phpBB:

$result=$auth->login($username, $password);

if ($result['status'] == LOGIN_SUCCESS) {

  echo "You're logged in";

} else {

  echo $user->lang[$result['error_msg']];

}

#1


11  

This is an old question so I'm sure you've worked something out by now, but if you need to refactor things in the future, this is entirely possible with authentication plugins in phpBB3:

这是一个老问题,所以我确定你现在已经解决了一些问题,但是如果你将来需要重构一些东西,这完全可以通过phpBB3中的身份验证插件完成:

http://wiki.phpbb.com/Authentication_plugins

I'm working on one now where phpBB is the "secondary" system, and it's going pretty well.

我正在开发一个现在phpBB是“辅助”系统的地方,并且它进展顺利。

#2


7  

I just worked on this task today, after some investigation implemented an Authentication plugin Here is a good example Getting phpBB to accept Django sessions

我刚刚完成了这项任务,经过一些调查后实现了一个身份验证插件这是一个很好的例子让phpBB接受Django会话

#3


6  

I have integrated phpBB with a site before, however I used phpBB's login system/users table as the primary one as you said. Since phpBB is a pretty advanced forum software, it would be a pretty time consuming project to change its user and login system completely.

之前我已经将phpBB与一个站点集成,但是我使用phpBB的登录系统/用户表作为主要的一个,如你所说。由于phpBB是一个非常先进的论坛软件,完全改变其用户和登录系统将是一个非常耗时的项目。

When I had to use the site's login as the primary one, I used PunBB. It was way simpler to modify PunBB.

当我不得不使用网站的登录作为主要登录时,我使用了PunBB。修改PunBB简单得多。

If you absolutely have to use your own login as primary, and phpBB, then I agree with you in that the easiest way would be to keep the tables synchronized, and call both the login scripts when somebody logs in.

如果你绝对必须使用你自己的登录作为主要和phpBB,那么我同意你的看法,最简单的方法是保持表同步,并在有人登录时调用两个登录脚本。

When you're inserting data into phpBB, the users table is pretty straightforward. Each entry has the basic info for a user, and if you have custom fields for the user profiles, they go into the profile_fields and profile_fields_data tables.

当您将数据插入phpBB时,users表非常简单。每个条目都有用户的基本信息,如果您有用户配置文件的自定义字段,则会进入profile_fields和profile_fields_data表。

One tricky thing is how phpBB encrypts user passwords. I think you have to use phpBB's function called phpbb_hash($password) to do that. It's declared in the file phpbb/includes/functions.php

一个棘手的问题是phpBB如何加密用户密码。我认为你必须使用phpBB的函数phpbb_hash($ password)来做到这一点。它在文件phpbb / includes / functions.php中声明

For the phpBB login code, see funciton login_box in file phpbb/includes/functions.php

有关phpBB登录代码,请参阅文件phpbb / includes / functions.php中的funciton login_box

#4


2  

You can use the below to login into phpBB:

您可以使用以下登录phpBB:

$result=$auth->login($username, $password);

if ($result['status'] == LOGIN_SUCCESS) {

  echo "You're logged in";

} else {

  echo $user->lang[$result['error_msg']];

}