How can I integrate users' logins from my site into phpBB?

我们两清 提交于 2019-11-28 06:29:13

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:

http://wiki.phpbb.com/Authentication_plugins

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

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

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.

When I had to use the site's login as the primary one, I used PunBB. It was way simpler to modify 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.

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.

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

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

You can use the below to login into phpBB:

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

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

  echo "You're logged in";

} else {

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

}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!