Topic: Help integrating my site and punbb?????
Hi,i want to integrate punbb to my site so that my site has a forum
Now,my site already published and it have database for site's activity
I already install punBB to my server and then I'm confused.How can I use my existing user in punBB because it's 2 different database
And then I found someone's tips in this forum which look like this.I already tried it and it didn't work out.Can you please help me??
4 situations you must predict and solve the problem
1. user is logging from your site
in your login class, function, script, whatever, put after your operations this:
include("./forum/config.php");
include("./forum/include/functions.php");
setcookie($cookie_name, serialize(array($your_sent_login, pun_hash($your_sent_pass))), $expire, $cookie_path, $cookie_domain, $cookie_secure);of course the forum directory path may be other in your case.
it sets the coookie for the forum.. as you can see, now when you logon on your site, the cookie is set and you're logged on the forum..2. if the user logs on by forum
on the top of /includes/common.php put session_start();
in /login.php, find the lines below and put code before:
/ * your site login code in here, session data saving, maybe database update, etc... of course put it in a working way, don't blame the forum if it's included ok - it must work */
setcookie($cookie_name, serialize(array($db_username, $form_password_hash)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
redirect($_POST['redirect_url'], $lang_login['Login redirect']);3. user loggs out from your site
in your private logging out code put this:
include("./forum/config.php");
include("./forum/include/functions.php");
setcookie($cookie_name, serialize(array('Guest', 'Guest')), time() + 31536000, $cookie_path, $cookie_domain, $cookie_secure);4. user logging out from the forum
find these lines and put your logging out code
setcookie($cookie_name, serialize(array('Guest', 'Guest')), time() + 31536000, $cookie_path, $cookie_domain, $cookie_secure);
/* here your private logging out code */
redirect('index.php', $lang_login['Logout redirect'])