Solved: 5 Years, 6 Months, 3 Weeks ago Using mybb database a user account for site
Solved: 5 Years, 6 Months, 3 Weeks ago
From what I understand you have a custom website and also a MyBB forum. You want all registration to be handled on the forum. My answer is based on this assumption.

You want to set up header links to MyBB's registration page and connect to the database used by mybb. The session cookie doesn't contain the user_id (that'd be a security issue, don't save the userId in a separate cookie if that was one of the options you considered) so you will have to extract it from the sessions table via a query.

I would advise you not to use 2 database connections for the sake of sessions and keep your main website in the same database as mybb.

Your other options are:
* using php's native sessions and only acessing the mybb's database when a protected page is called and $_SESSION['user_id'] is not set. writing a mybb plugin to unset $_SESSION['user_id'] on logout and set it on login.
* setting a hashed cookie containing the user_id on mybb login and unsetting it on logout (not recommended, still an option)
* integrating your own registration with mybb and tweak the login system to redirect to your forum_login.php (which creates mybb session or displays your login page if not possible), long process but this is what I usually prefer

Let me know if you want me to explain any of the above.
[Image: axolis.png]

Project, Portfolio and Product management for freelancers.

Messages In This Thread
RE: Using mybb database a user account for site - by SentoWeb - 2015-10-02, 08:16 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)