1 (edited by milkiway 2010-08-18 12:03)

Topic: website + punBB : 1 register form, 2 accounts. How to handle it ?

Hi there,

I've just discovered punBB and must assume it ROCKS ! big_smile
I have a self-developped website with a self-developped user area (if only I had knew before that punBB could handle a member area with login.........).
I got a lot of members. Impossible to recode my user area to go for punBB on the website, too many things to change.

I've installed a punBB 1.3 in a /forum/ folder and deactivated registering on forum.
When a user register to my website, I add a line in the "users" table of punBB so that he has in a single register two acounts with the same login/pass : one for the website, one for the forum. (This line is created by a INSERT INTO self-coded query, I don't use the "common.php" file).

Everything works well BUT.... once registered, the new member has to login to both website and forum. I would like to log the member to both website and forum just by filling the login form of the website.

My questions :
1- How are sessions handled by punBB ? Cookie only or cookie + $_SESSION ?
2- How could I create a punBB compilant cookie for my system to work ?

Here is what I've added to my own login system :
When the user is logged in and verified :

function forum_setcookie($name, $value, $expire)
{
    global $cookie_path, $cookie_domain, $cookie_secure;

    // Enable sending of a P3P header
    header('P3P: CP="CUR ADM"');

    if (version_compare(PHP_VERSION, '5.2.0', '>='))
        setcookie($name, $value, $expire, $cookie_path, $cookie_domain, $cookie_secure, true);
    else
        setcookie($name, $value, $expire, $cookie_path.'; HttpOnly', $cookie_domain, $cookie_secure);
}
//
// Set a cookie, FluxBB style!
// Wrapper for forum_setcookie
//
function pun_setcookie($user_id, $password_hash, $expire)
{
    global $cookie_name, $cookie_seed;

    forum_setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash), $expire)), $expire);
}
$expire = ($save_pass == '1') ? time() + 1209600 : time() + $pun_config['o_timeout_visit'];
pun_setcookie(2, $form_password_hash, $expire);
}

And nothing happens sad Any idea why ?

Any help really appreciated
THANKS !

Re: website + punBB : 1 register form, 2 accounts. How to handle it ?

Well, I'm done. big_smile
I still have a problem. When I call the common.php file, I get this message :

Unable to confirm security token. A likely cause for this is that some...

??

Re: website + punBB : 1 register form, 2 accounts. How to handle it ?

Welcome to PunBB;

Are you having this issue:

http://www.devcomments.com/Unable-to-co … 293308.htm

also see this

http://punbb.informer.com/forums/topic/ … ity-token/

Re: website + punBB : 1 register form, 2 accounts. How to handle it ?

Thanks wink !