Auto Registration and Logins

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
6links
Registered User
Posts: 30
Joined: Sat Nov 26, 2022 11:35 am

Auto Registration and Logins

Post by 6links »

My question is about User registration and logging in and perhaps simpler to explain this in list form
  1. Users on my website are registered users (username/email/password)
  2. Access to my phpBB board is via the website's main menu
  3. Is it possible to register users on the phpBB board (i.e. add their credentials on the phpBB users table) by program (passing their credentials as parameters) at the time they register on my website. This would avoid the need for users to register separately on the Board.
  4. Is it also possible to programmatically assign them to a User defined group at the time of registration.
  5. Once registered can users be granted access to the Board without the need to login (again by program my website would pass their login credentials to the Board)
I'm only just setting up my Board so would appreciate any comments or help on this as I can then plan the way forward.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26505
Joined: Fri Aug 29, 2008 9:49 am

Re: Auto Registration and Logins

Post by Mick »

What do you mean by ‘website’, is it something you’ve written in html or a Wordpress type of thing, what is it exactly?
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
6links
Registered User
Posts: 30
Joined: Sat Nov 26, 2022 11:35 am

Re: Auto Registration and Logins

Post by 6links »

Hi Mick, It's a HTML/PHP website that I have developed. Here's the registration link.
I'm now waiting for your further reply with baited breath :-)

ps: I love the support on this forum. You guys really rock!
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26505
Joined: Fri Aug 29, 2008 9:49 am

Re: Auto Registration and Logins

Post by Mick »

Ok, I'm going to move this to custom coding hopefully someone there can help you. Beware though, they may ask to see your code. You could also try making a request in the Wanted! forum although I suspect it wouldn't be cheap.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
User avatar
DeadlineEm
Registered User
Posts: 10
Joined: Thu Dec 01, 2022 10:35 pm
Contact:

Re: Auto Registration and Logins

Post by DeadlineEm »

If i may chime in, I know im a newbie here. Do you mean you want to integrate your board and the forums to one user system? If so, I'm basically working on the same thing myself. If you're referring to cloning the current users from your site, to the forum and then making one registration system, that is also possible.

For the registration system, you'd just connect to your phpbb database using a config file (you can do this in PDO which i recommend) Here is mine for example:

Code: Select all

define('DB_HOST', 'Your.Database.Host');
define('DB_NAME', 'Database Name');
define('DB_USERNAME', 'Database Username');
define('DB_PASSWORD', 'Database Password');
define('ERROR_MESSAGE', 'Oops, we ran into a problem here');

try {
$odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
}
catch( PDOException $Exception ) {
	error_log('ERROR: '.$Exception->getMessage().' - '.$_SERVER['REQUEST_URI'].' at '.date('l jS \of F, Y, h:i:s A')."\n", 3, 'error.log');
	die(ERROR_MESSAGE);
}

function error($string)
{
return '<div class="alert alert-danger alert-dismissable"></button><strong>ERROR:</strong> '.$string.'</div>';
}

function success($string)
{
return '<div class="alert alert-success alert-dismissable"></button><strong>SUCCESS:</strong> '.$string.'</div>';
}
The config file can be included in your website header using php include, or require.

After that, its as simple as writing a registration script to register phpbb users to the tables, give them proper permissions, etc.

As far as converting your users table to phpbb to insert your current websites users, do a side by side window of both SQL files and just write your own info really. Not sure if theres converters out there. Otherwise id honestly have them register on their own while your creating the new registration page and then any newcomers can use the new dual registration page system afterwards.
6links
Registered User
Posts: 30
Joined: Sat Nov 26, 2022 11:35 am

Re: Auto Registration and Logins

Post by 6links »

Mick wrote: Fri Dec 02, 2022 10:15 am Ok, I'm going to move this to custom coding hopefully someone there can help you. Beware though, they may ask to see your code. You could also try making a request in the Wanted! forum although I suspect it wouldn't be cheap.
Thanks Mick for putting my question in a better place. My project is essentially a non-profit one so I'll need to stay right out of the Wanted!
6links
Registered User
Posts: 30
Joined: Sat Nov 26, 2022 11:35 am

Re: Auto Registration and Logins

Post by 6links »

DeadlineEm wrote: Fri Dec 02, 2022 10:52 am If i may chime in, I know im a newbie here. Do you mean you want to integrate your board and the forums to one user system? If so, I'm basically working on the same thing myself. If you're referring to cloning the current users from your site, to the forum and then making one registration system, that is also possible.
Thanks for chiming in and thanks for the deets you provided. You're a newbie here and I've only been here for about a week myself so not that far ahead of you. I have to say, the support is really awesome. I'm also a php newbie, in fact I've only just created my first website and trying to integrate phpBB into it as a need to move out of Telegram chat group which provides very limited capability and only basically "linear" to messaging.

Yes that's exactly what I want to do. I don't see a need for users to have to register for the phpBB (an item on my websites main menu) when they are already registered on my site. As I have different user levels on my website, I also want to allocate them to specific User Groups on the phpBB at the time of registration. All this provides a much better and streamlined user experience. I'll have to digest what you've said but I'd love to keep in contact with you as it seems that we are both trying to achieve the same (logical) thing.
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52768
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Auto Registration and Logins

Post by stevemaury »

Have you considered LDAP?
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
6links
Registered User
Posts: 30
Joined: Sat Nov 26, 2022 11:35 am

Re: Auto Registration and Logins

Post by 6links »

I've just had a quick look at LDAP Steve and thank you for the suggestion. I read the notes and watched the video but just can't see how it works.

I can't help but feel that once a user is registered on my app, then can login to phpBB which is like a subfunction/discussion forum of the main app. It's like a user could register/login to my app and then select/enter say a blog on that app without having to register/login to the blog itself. For this reason I''m thinking along the same lines of DeadlineEm.

I'm also struggling to understand that others before me haven't had this or a similar requirement or that phpBB doesn't provide a way for achieving this. Maybe I'm missing something! For simplicity, I'm happy for the user credentials to be stored in the phpBB user table and use the details in that table for when the user needs login/be authenticated for the main app. I just don't see the need for a user to have to register/login in two places!
User avatar
DeadlineEm
Registered User
Posts: 10
Joined: Thu Dec 01, 2022 10:35 pm
Contact:

Re: Auto Registration and Logins

Post by DeadlineEm »

6links wrote: Fri Dec 02, 2022 3:33 pm
To be 100% honest with you, its a sad truth to the factor that you may end up going one of those routes, we are going on the lines of the same thing, however, my site is being built directly around phpbb because my site is also brand new.

Code: Select all

https://kaos-inc.ga/
is my main websites home, which is coded in php but gathers its data from the forums/users/etc.

There MIGHT be a way you could run some sort of dual authentication using cookies/session headers and php PDO but, im not certain. Biggest problem you face is that database merge. You can feel free to PM me, i might be able to come up with some quick fixes for you or something of the sort. I personally build my own CMS for things so i can integrate it how i want to.

Also, forgot to mention, if you DO manage to hand write your own database file to convert it, you CAN insert your custom user groups in manually as well, in their appropriate spots, of course.
Last edited by Mick on Sun Dec 04, 2022 10:17 am, edited 1 time in total.
Reason: Removed unnecessary full quotes.
6links
Registered User
Posts: 30
Joined: Sat Nov 26, 2022 11:35 am

Re: Auto Registration and Logins

Post by 6links »

This all sounds good DeadlineEm and being new to all this, including the php stuff, I really appreciate your advice and help. I'll do some work so that I'll be in a much more knowledgeable place to char further.
User avatar
DeadlineEm
Registered User
Posts: 10
Joined: Thu Dec 01, 2022 10:35 pm
Contact:

Re: Auto Registration and Logins

Post by DeadlineEm »

6links wrote: Sat Dec 03, 2022 11:44 pm This all sounds good DeadlineEm and being new to all this, including the php stuff, I really appreciate your advice and help. I'll do some work so that I'll be in a much more knowledgeable place to char further.
php is more tedious than anything tbh. You can literally bend your own world with php, IF you know the right code to do it. You can always hmu with any questions, i dont charge unless im building a project, knowledge is free.
User avatar
DeadlineEm
Registered User
Posts: 10
Joined: Thu Dec 01, 2022 10:35 pm
Contact:

Re: Auto Registration and Logins

Post by DeadlineEm »

stevemaury wrote: Fri Dec 02, 2022 3:41 pm Have you considered LDAP?
He's looking to convert his current (Main site) user system to phpBB's platform seamlessly so people don't need to reregister on the forums, then he wants to make his main sites registration page, register users to both the main site and phpBB and for logins to log user into both the main and the phpbb forums simultaneously. If his main site and forum are on the same host, the sessions for both should stay on the host, correct?
Therefore, his current login page would just have to have the proper code to log into the phpbb forums.

Could use help locating that bit of information as I'm new to phpBB

As long as the users/passwords match and the encryptions are sent to the right places (one uses MD5, the other uses Bcrypt 10 cost) the login should send properly, right?
Post Reply

Return to “phpBB Custom Coding”