1 (edited by dragnovich 2006-10-03 20:57)

Topic: HOW LOGIN ROUTINES WORK??

Hello I had an intranet system that needed a forun, so I choice PUNBB to solve the problem, everithing is PERFECT but a misterious thing is happening....

I want to my users login using MY standard login screen, and then use the system as usual, but if they click in the "Furum" link, they get in the PUNBB, forun directly logged (they MUST NOT be prompted with the PUNBB login screen).

Ok I use on ALL my system SESSION to log users, and PUNBB uses COOKIES.. So I say Ok lets analyze how users are getting logged to PUNBB.
after a little scan for the login.php script, I noticed at the end of the login routine, and all the checkings PUNBB use:

$expire = ($save_pass == '1') ? time() + 31536000 : 0;
$phash = pun_hash($_POST['passwd']);
pun_setcookie($user_id, $form_password_hash, $expire);

So I added to my system loggin function the same lines and values... (ABIUSLY I  ADDED THE INCLUDE for the functions.php & config.php files) I also changed the encription of my standard site to use the same as PUNBB (the one I use was a shame!)... so when I change a password in the SYSTEM the password changes perfectly in PUNBB too (I removed the password change pages and register, from PUNBB to my system routines too).

And almos all work perfect, If I create an user in my system, it gets created in PUNBB too, if a password is changed PUNBB is changed to.. and all works perfect, but when I log in my system and access to PUNBB, I get the message that Im no logged. The strange thing is that THE COOKIE IS CREATED in my login script, so that's means that "pun_setcookie" is working, but PUNBB don't recognize it so did't, let me log automatically

So what Im missing ??? is there any thing Im missing all arguments for the pun_setcookie funtion are bee sent...

$cookie_name = 'punbb_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$cookie_seed = '4eef3665';