1 (edited by John_S 2009-02-13 20:39)

Topic: Using PunBB user authentification in an external page.[CODE INCLUDED]

Greetings everybody,

I decided to make a website in which I count to use PunBB, however I would like to have only one user authentication system and I thought if it was possible to use the PunBB's one.

Does anybody know how to do so?

Thanks a lot in advance!
John

Errare humanum est

Re: Using PunBB user authentification in an external page.[CODE INCLUDED]

maby look in the wiki for your answer!

3 (edited by John_S 2009-02-13 20:52)

Re: Using PunBB user authentification in an external page.[CODE INCLUDED]

Hello, I did that already but there is nothing about the user authentication in the Wiki.
Anyway, doesn't matter, I found the way, thanks for help anyway.

I wound how to do it. It's quite easy actually.

Integration of the PunBB 1.3 into your website (user authentication system)
Simply add this code at the first line of your code (in the very top)

define('FORUM_ROOT', 'forum/');
require FORUM_ROOT.'include/common.php';

// Replace 'forum/' by the directory name in which you have your punBB installation. Example:
If you have your PunBB forum under: www.yoururl.com/yourforum/ and your script in which
you want to use the user authentication is in www.yoururl.com/  then replace forum/ in define by 'yourforum/'

Once you do that, you can use $forum_user variable in your script, note that it is an array
which contains all the data about the user who's viewing the page. 
(Id, Group Id, Username, Email and so on...)

That's all smile
EDIT: Added that part to the PunBB 1.3 Integration in Wiki.

Errare humanum est

4 (edited by Reactor 2009-02-14 14:31)

Re: Using PunBB user authentification in an external page.[CODE INCLUDED]

After adding this code I've 2 errors.

Notice: Undefined index: userfile in /var/www/pcmod/img/uploaded/index.php on line 5

if (is_uploaded_file($_FILES['userfile']['tmp_name']))

Notice: Undefined variable: content in /var/www/pcmod/img/uploaded/index.php on line 162

<?php echo $content; ?>

5 (edited by John_S 2009-02-14 15:34)

Re: Using PunBB user authentification in an external page.[CODE INCLUDED]

Reactor wrote:

After adding this code I've 2 errors.

Notice: Undefined index: userfile in /var/www/pcmod/img/uploaded/index.php on line 5

if (is_uploaded_file($_FILES['userfile']['tmp_name']))

Undefined index errors seem to appear within the PunBB in general, I have that error on my user list page, so I doubt it's because of the integration. I tried everything I knew to fix them, I still couldn't find a solution :s


Notice: Undefined variable: content in /var/www/pcmod/img/uploaded/index.php on line 162

<?php echo $content; ?>

What content are you trying to display?

Errare humanum est

Re: Using PunBB user authentification in an external page.[CODE INCLUDED]

This content is buffored earlier. HTML Code, some outputs from MySQL etc.