How to integrate phpbb forum login

I have had to install phpbb forum on a website that already had a user table and I want to…

September 17, 2010


I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of and and I'm actually the Chief Technical Officer of Better Days web agency.

Comments on “How to integrate phpbb forum login”

18 thoughts

  1. ramdhan84 says:

    i’ve found a problem .. Fatal error: Call to undefined function execute_row() when i’m trying to login.
    what is execute_row() ??


  2. ramdhan84 says:

    Nevermind … I’ve found the problem

  3. Here's one says:

    This looks like it’s pretty happening.
    Haven’t tried it yet, but it looks like it works on the guy’s demo site.

  4. Dave says:

    Does this handle checking for an existing user by username/email address?

    I had a quick look through it but couldn’t see any reference to it.



  5. Produse Albire Dinti

    Albiti-va dintii rapid si eficient cu gama Crest Whitestrips. Veti obtine un zambet alb si stralucitor in numai 3 zile.

  6. Soulast says:

    i love your tutorial but im having big time problem
    Is any1 know how to solve that error:

    Fatal error: Call to a member function sql_query() on a non-object in \forum\includes\cache.php on line 51

    It is always showing when im trying to login thx for any help in advance

  7. David says:

    General Error
    SQL ERROR [ mysqli ]

    Can’t connect to MySQL server.

    An sql error occurred while fetching this page. Please contact an administrator if this problem persists.

  8. Jamar Phu says:

    Why spend money when you could learn for free ? That is the idea on the internet. Regardless of what you are searching for, the Internet always has an answer for you.

  9. stefano says:

    Buongiorno Giulio.
    Mi permetto di disturbarti, riguardo al tuo post
    – How to integrate phpbb forum login

    siamo un gruppetto di programmatori dilettanti che hanno un proprio sito
    con un proprio sistema di registrazione ed autenticazione.
    scritto da noi e quindi facilmente modificabile e configurabile basato su un db mysql.
    vorremmo appunto integrarlo con un forum

    la mia domanda base era (prima di perdere decine di ore in un lavoro al limite delle nostre capacità)

    – è, secondo te, possibile accedere a phpbb tramite il nostro sistema di login
    utilizzando il tuo sistema, ma PASSANDO i dati dei sottogruppi/forum a cui l’utente può accedere
    ovvero che l’utente A possa partecipare ai sottoforum Sezione1, sezione2
    mentre l’utente B possa accedere ai sottoforum Sezione1 e Sezione3 ecc ecc
    basandoci sui dati del nostro db opportunamente adattati?

    Se sì, partirebbe la seconda domanda: come? :-)
    ma sarebbe già sufficiente sapere di lavorare su un obiettivo possibile!

    Grazie per l’attenzione

  10. Djtale says:


    Thank you for this tutorial. It is exactly what I need.
    But I have one question.

    I have my index.php with the form to login.

    When I log in, the form calls login_member.php in which I have my authentication process with the phpBB3Integration.class included.

    At the end of the authentication, I redirect the user to the index.php page. But if I try to use the variable $user, I have this error “Notice: Undefined variable: user”.

    Do I have to insert another code in index.php ?

    Thank you.

  11. Giulio Pons says:

    Possibile lo è, di sicuro. E forse visto quanto tempo è passato dal vostro commento, l’avete già fatto!

  12. Thanks for the tutorial, very helpful.
    Btw, i found a bug:
    When you insert a new user into phpbb_users table, you must insert the original username in “username” column, but in “username_clean” you must insert the username with all lowercase character. In your script, this doesn’t happen, being the username_clean not converted to lowercase. So, for example, if i create in my register.php script a user with uppercase letters (for example Alberto), the username_clean column will contain “Alberto” insted of “alberto”.
    why is this important? Because if i create a user in my register.php script with username containing some uppercase letter, i will never be able to login into the forum. Don’t ask me why, but it happens.

    How to fix this bug?

    change into phpbbintegration.class.php the following line
    $sql .= “NULL, ‘0’, ‘2’, ‘00000000006xv1ssxs\ni1cjyo000000\nqlc4pi000000\nzik0zi000000’, ‘0’, ‘” . $ip . “‘, ‘” . time () . “‘, ‘$username’, ‘$username’,”;
    with the following two lines
    $username_lower = strtolower($username);
    $sql .= “NULL, ‘0’, ‘2’, ‘00000000006xv1ssxs\ni1cjyo000000\nqlc4pi000000\nzik0zi000000’, ‘0’, ‘” . $ip . “‘, ‘” . time () . “‘, ‘$username’, ‘$username_lower’,”;

    Hope it helped

  13. Wing says:

    The createSqlToAddUserRow needs to escape the fields it’s adding.
    At present, this code is vulnerable to SQL injection.

  14. soesilo says:

    Thanks, but it lacks of these functions:
    -changeUsername() // to change forum’s username
    -deleteUser() // to delete a user upon website user deletion

  15. Chris says:

    i am pretty sure there is bug in filling username_clean in phpBB_users when using capital letters.

    as soon phpBB_users.usernameclean contains capital letters, the user is not recognized (not by phpBB admin, which is really strange), as soon as I manually changed phpBB_users.cleanname (its only the cleanname) to small letters only, everything works.

    you can see it at the bots, the username clean is always small letters.

  16. Michael says:

    Not sure if this is still reviewed, but I have a problem with the login portion. The addition of the user to phpbb works fine, but it will not log them in. I am using version 3. Any thoughts on where the issue might be? I have essentially the exact same code for the login as you mention above. Thanks.

  17. Naung says:

    I integrated phpbb w/ my php site as you instructed. It’s working great but new users who register thru my script are not showing as newest member. That is why I always click Resynchronise statistics in admin panel to show new members. Please advise for my issue.
    I really appreciate for your Integration class.
    Thank you,

Comments are closed


How to build a spider… uh, well an email scraper

What is a spider? A spider is a program that automatically navigates web pages to find informations. These informations can…

November 26, 2013

Updated version of the the Facebook Connect Tutorial

I’ve written un updated version of the Facebook Connect Tutorial, you can find it in the top menu of…

October 10, 2012

How to capture enter key pressed in a form (JavaScript)

Suppose you have a login form and you want to send the form when user press enter on his keyboard…

February 16, 2010

Count coloured cells on Google Sheets with reference

In a spreadsheet if you need to count cells based on their background you can use this code in Google…

May 22, 2020

WP doesn’t send email? try this

Snippets for sending emails with Wordpress

February 8, 2020

Two post types share the same taxonomy in WordPress

Sharing a WordPress taxonomy between two post types is useful especially if you want to create a relation between different…

November 14, 2019