Topic: Integrating with my own login

Hi. I tried searching for this but nothing relevant came up.

I already have a login for my site. I would like punbb to follow the same. So I wish to add perhaps a file in the header or something that checks for my website's login, and if a user is found, then it sets the FluxBB cookies or whatever so that FluxBB *thinks* that the user is logged in.

If needed, I can also update FluxBB user db with info of my own db, so it shows them as registered users. I also store user id, and password in md5. We don't have too many hashes and stuff like that.

Based on the above, is there any plugin/extension, or some set of instructions to integrate FluxBB on to the existing registered users? For PunBB, I found some suggestions here (vague to me) --

http://punbb.informer.com/forums/topic/ … and-punbb/

Wonder if the same will work for FluxBB too?

Thanks!

Re: Integrating with my own login

You should use FluxBB's user table.

I hope you have a login script already set up. If not, look at FluxBB's login.php.

To check if the user is logged in, do something like the following:

define('FORUM_ROOT', '/path/to/your/fluxbb/root');
include FORUM_ROOT.'include/functions.php';

$my_user = array();
cookie_login($my_user);

if ($my_user['is_guest'])
     echo 'not logged in';
else
     echo 'logged in';

Hope that helps.


EDIT: Added include file.
EDIT2: Fixed include file and function name.

Last edited by Franz (2009-02-03 10:00:16)

http://www.fluxbb.de - Deutschsprachiges FluxBB-Supportforum

Re: Integrating with my own login

Thanks for this. But we already have a login system working and cannot touch it. It's a highly secure website.

The forum will have to make use of that login system instead.

As I said, I don't mind populating the FluxBB database with my own user information, and when a new user registers, FluxBB will get a user too. Would this help?

What I am looking for is to perhaps to edit some code in FluxBB's login.php which makes use of our system login. We already have cookies set for the user. How can I set the same cookies for FluxBB, or make sure that FluxBB check the same cookies? When a user logs in, we set all these cookies in one go: for us, and for FluxBB. 

Your post is quite useful as it gives me some starting points to look at: common.php and login.php, but I guess I am afraid I might break some functionality in FluxBB, so I was just wondering the exact variables that may need to be set to achieve the above. 

Welcome any thoughts. And btw, I'm loving this fork of punbb.

Re: Integrating with my own login

Note of clarification to lie2815:

To check if the user is logged in, do something like the following..

Actually I want the exact opposite. The user will *not* login from FluxBB. The user will login from our website's usual login. On the FluxBB page, I simply want FluxBB to know that the user logged in.

This could happen in one of the following ways:

1. When user logs in on our usual interface, we also in the background log him into FluxBB. This automation might work well (and user table across our database and FluxBB's database can be synced).

2. Or, just "spoof" FluxBB into thinking that a user has logged in by setting the right cookies -- no munging around with user tables and stuff like that.

Thanks for any thoughts.

Re: Integrating with my own login

Then you should probably register users in both databases. You should be able to check for the user being logged in with the above script. I just fixed it.

For logging in, look at this file (login.php) from line 38-86.

http://www.fluxbb.de - Deutschsprachiges FluxBB-Supportforum