MyBB Community Forums

Full Version: Where is the login Session and Cookie settings stored?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

When someone is logged into my forum, I want to use the fact they are already registered and logged in on my site through the forum and allow them to see other pages on my MAIN site that only the logged in can see.

However I need to know what session and cookie I need to call to check to see if they are logged in or not.

Can anyone help?

Much appreciated thanks.
forg if you know php scripting you should check member.php. It'll tell all to you. It's clear enough.
Thanks for the pointer.

I found I can call $_COOKIE['mybbuser']; but this cookie holds a UID string for the logged in user.

How could I get there username?

Is this pre stored in a 'logged in' session/cookie?

Thanks again.
" select s.*, u.username from sessions s join users u on s.uid=u.uid; " will select all columns from sessions table and username from users table. Also you may want to use " select s.*, u.username from sessions s join users u on s.uid=u.uid limit 1; " or " select s.*, u.username from sessions s join users u on s.uid=u.uid where s.uid=YOURUSERUID limit 1; " etc.
That's really confused me.

From my understanding so far when you log in to the forum the forum sets 2 cookies:

1) The first cookie stores the uid from the table mybb_users and the login key concatenated together.

2) The second cookie stores a new session id.

In the top of the forum it will say Welcome back, <USERNAME>

Have i got to run a query on the database comparing one of the cookies to the users table to pull out the username or is there a simpler predefined session or cookie holding this?

If there isnt and the former is true, then I have no idea how to compare the cookie to the table with a query becuase the cookie is holding a concatenated value of uid and login key together...

Thanks again...


EDIT: Problem solved, I used a php function called Explode on the cookie and compared the two values in the database for a secure login session.