miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Master Class miniBB Support Forums / Master Class /  
 

miniBB cookie format / Login status on other pages of the website, if user is logged in on forums

 
Author different
Partaker
#1 | Posted: 12 May 2004 04:14 
Hi there,

I am hoping to use miniBB as it looks like a fast, efficient forum.
I have a question about getting the user_id of the logged in user.
I would like to display the name of the logged in user on pages on my website that are not part of the miniBB installation.

So, for example, I could show on the home page the name of the currently logged in user, if there is one.

Could you please help me with the code needed to extract the use_id of a logged in user please (from the cookie somehow I guess). I have looked through the code, but am finding it difficult.

Thanks for your help.

Author Team
8-)
#2 | Posted: 12 May 2004 10:24 
Cookie is set in the following format:

"USERNAME|MD5_PASSWORD|EXPIRE_TIME"

You need to explode this cookie string by "|".

But, for reading cookie information, you need to set path to something like "/" in the options. So the script in the root directory could read cookie set up in the subdirectory.

But the best solution would be - of course - if you synchronize miniBB and your own engine to get work based on the same users table in database.

Author different
Partaker
#3 | Posted: 12 May 2004 11:39 
Thanks Team, that makes sense to me. I will give it a go.

Author Anonymous
Guest
#4 | Posted: 12 Jul 2004 23:11 
Hi,
First of all i think this is one of the best forums that i have ever used. I am now trying to integrate it in such a way that if a user is logged onto the site he is also logged into the forum!

I use the same db table for my users as i do for the forum. I would like to ask if someone could reply with information about the cookies (and values) that the forum sets upon login. I am experienced at php but not very fond of working my way around foreign code!

I already read that integrating is charged a certain amount :) but integration is not what im looking for...i just need the cookies (or session vars) that the login procedure initialises in order to make my life easier :) (i.e. so that i dont have to bother debigging).

Thank you for your time!

Author Team
8-)
#5 | Posted: 13 Jul 2004 10:38 
Cookie options are set in the file setup_options.php.

Cookie is set in the following format:

[USER_NAME]|[USER_PASSWORD_MD5_ENCODED]|[EXPIRATION_TIME]

So probably you'll need 2 first parts of this value.

Author Anonymous
Guest
#6 | Posted: 13 Jul 2004 14:45 
Thank you! I have successfully set up logging in through my sites login page! I set only the first two parameters of the cookies value. I get the cookie name from setup_options.php and logging in works perfectly.

There is a slight problem with the logout procedure. Namely, only deleting the cookie does not seem to do the job because if i head back to the forum i still see myself logged in !!!

I use the following :
setcookie('$thename', 'xxx|md5(yyy)|0','0','','',0)

where $thename is the value from setup_options.php; xxx is the login and yyy the password!!!

does index.php set any other cookie i should be aware of?!?!? of any other var that should be killed !

again thank you for your support!

Author Anonymous
Guest
#7 | Posted: 13 Jul 2004 14:48 
slight correction :)

instead of: 'xxx|md5(yyy)|0'
i meant: 'xxx|'.md5('yyy').'|0'

(by the way these r sample usernames :) not the real thing)

Author Team
8-)
#8 | Posted: 13 Jul 2004 15:18 
When deleting cookie, you need to set EMPTY value. Thus, the cookie path should be general both for your site and forums.

Author realitybytes
Partaker
#9 | Posted: 10 Apr 2005 01:08 
Just hoping I can get a breakdown of the cookie that is stored, as I am creating an authentication script for my entire site, which works very well except for one part which has me a little baffled.

When I view the cookie it shows the following contents

username|md5 hashed pasword|series of numbers

e.g.

admin|ga9x6cge14m4823964chw5f6clb3fc41|1113049725

The last series of numbers 1113049725 is causing some problems for me, I set the cookie with my own script as follows

setcookie('forumcookie', $cookName.'|'.$cookPass.'|'.'1113049725', time()+108000, '/', '', 0);

works good until the last series of numbers changes, once the forum is used to login, this does not fail login on my my script however if I login and set the above number on the site then go to the forum I have to reneter my password.

*****EDIT*****
It is ok I think I have found a way around it,

$cookTime = time()+108000;
setcookie('forumcookie', $cookName.'|'.$cookPass.'|'.$cookTime, time()+108000, '/', '', 0);

it all runs smooth!!

Author Team
8-)
#10 | Posted: 11 Apr 2005 11:34 
Yes, third parameter is last visit time which is used in miniBB for re-setting cookie when it is close to expiration.

Master Class miniBB Support Forums / Master Class /
 miniBB cookie format / Login status on other pages of the website, if user is logged in on forums
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑