Website + forum and a shared login, handle with php or forum software?

Hi everyone.

Let me start out by saying I am not sure that this is a PHP problem, but my website is coded with it so I will ask here. Please feel free to direct me elsewhere if need be.

I have a website set up using PHP/MySQL. The site has a fixed database (that I add items to frequently) of a specific item type and displays those items on the main page, in different sections, along with some sorting options. That’s all the site is.

But I also want people to be able to register an account and have their own user page at www.mydomain.com/user/ that displays item choices (that they have picked from my database listings on a separate user settings page). Then other people can visit a user’s page to see a their choices. I also want this to tie in with the main page sorting options to have a sorting option for sorting by ‘items with most users to least users’ etc.

That’s all well and easy. I can do that, but here’s the tricky part as I’ve never dealt with it before…

I also want to add a forum to the site, and I want there to be a ‘combined’ single login for the whole page, ie: you log in on the main site, allowing you to set up your personal user page etc…but I also want that user to be logged into the forum automatically at the same time.

So my question is, is that type of login system a pure PHP coding task for me, or is it something forum software can handle? I guess I’m asking, which end do I tackle this from. If forum software can do this that’d be great, even if I have to fiddle with it a bit. It would be far less stress for me. I should also mention, I do not mind paying for the forum software at all, if need be. Just want to get this set up as quick as I can.

I also want the forum to be able to be customized so that it is styled like my main page.

Any direction in this matter would be greatly appreciated!

  • oknow

What you’re looking for is known as Single Sign On (or SSO for short). That should help you in your search. Several forum software packages have options for this. Like for phpBB, see https://www.phpbb.com/kb/article/phpbb3-cross-site-sessions-integration

Beautiful, thank you very much. I knew it was possible, and I searched a fair bit but couldn’t find exactly what it was called.

One further question just to see how I should approach this.

So as of now I have the site at the stage where I have my own database set up (entries and all), but no user registration/login system as of yet. My items simply display on the main page and are sortable by anyone that visits the site.

  1. Could I implement forum software at this stage, and then just use that login/registration system. Would I be able to use that to set up a login box (and a registration page) on my current main page that logs people into the forum (or registers them as a user for the forum)?
  2. And could I use that forum login information to allow users to set up the personalized user homepage I was describing before: by visiting a custom page of my own making with options that display items to choose from MY original database, and putting those choices in another custom table of my own, and then checking that table vs the forum username table to see how many people use which items etc.

Or MUST I create a separate user registration/login system myself first, and link them together afterwords?

I hope that made sense, I found it difficult to word. :smiley:

Yes, you can set up a box on your homepage that logs people in to the forums, but you need to the post the data to the forum login URL. (I’m assuming the forum doesn’t have anti CSFR measures; if it does you can’t do this).

You could do it both ways. If you use the forum login throughout (again, assuming it doesn’t have anti CSFR measures), you need to tap into the code of the forum to get the required info like username, etc. The other way around you’d need to know how to invoke the forum’s code telling it someone is logged in.
I’d personally prefer to have my own login system and tell the forum what to do when someone logs in on my homepage so I get full control over how logging in works, how the passwords are encrypted etc. Plus, if you ever want to change which forum software you use it’s easier to adapt your code to talk to the new forum than the other way around, since the new forum software might use a different password hashing system etc.

Thank you thank you thank you.

Makes sense to me, and I agree with your reasoning behind having your own login system instead of the other way around, for sure.

Really appreciate the help on this, now it’s time to go research vbulletin vs phpbb and then get to work.

Thanks again!