Cookies.....Oatmeal Or Peanut Butter?
Moderator: General Moderators
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
Cookies.....Oatmeal Or Peanut Butter?
I thought the topic name would get people's attention. Does anyone know anything about how to use cookies? I need to know how to make my page outside of phpBB share the same cookie as my phpBB board. Does anyone know anything about it?
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
unserialize() the array and check the md5()'d password against the database with the ID in the array...
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Heh.... I think you just wanna know how to even read the cookie in the first place right?
Code: Select all
$data = $_COOKIES['phpbb2mysql_data'];
$data = unserialize($data);
print_r($data);-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
md5() go here: viewtopic.php?t=25624 <-- outstanding tutorial
unserialize() the manual does it pretty good justice. It's just the process of converting a serialized variable back into a php variable: from the manual.
that clear it up?
unserialize() the manual does it pretty good justice. It's just the process of converting a serialized variable back into a php variable: from the manual.
because the phpBB cookie, is a serialized array with two keys/values, you need to unserialize it, and grab the values from the array (the md5'd password and the id of the user). With those bits of information, you can query your database (assuming the ids and passes match the phpBBs) to check authentication of the user. Your best bet might be to just use the phpBB table to ensure you don't have any crossed user paths.unserialize() takes a single serialized variable (see serialize()) and converts it back into a PHP value. The converted value is returned, and can be an integer, float, string, array or object. In case the passed string is not unserializeable, FALSE is returned.
that clear it up?
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
That cleared up quite a bit. But to keep things simple, where would I find the code that phpBB uses to check the cookie, so that I can make sure to make it work right? I just need to know the code to put in the page for the user to be logged in as long as they have the cookie to be logged into the board. I appreciate your explanation though, cause I really did learn some new stuff. It kinda lost me at what a serialized variable is, but guessing by the name, I guessing that the data stored in the variable is encrypted and thats where it gets the name?
Also, with
[/quote]
nothing is being displayed when I print or echo $data. I know I have that cookie because I'm logged into my forum. Any reason why that is?
Also, with
Code: Select all
$data = $_COOKIES['phpbb2mysql_data'];
$data = unserialize($data);
print_r($data);nothing is being displayed when I print or echo $data. I know I have that cookie because I'm logged into my forum. Any reason why that is?
Last edited by Majoraslayer on Thu Jul 07, 2005 4:03 pm, edited 1 time in total.
not encrypted, just converted to a string so it can be stored in other mediums (db's, cookies etc).
it's been a very long time since I played around with phpBB so I honestly cant' remember where the code is that checks against the cookie for validation.
you might try searching all of the phpBB files for "cookie" or "unserialize".
no matter, you can do what you're trying to do w/o finding their code...just do what I told you to do and you'll be good as gold
it's been a very long time since I played around with phpBB so I honestly cant' remember where the code is that checks against the cookie for validation.
you might try searching all of the phpBB files for "cookie" or "unserialize".
no matter, you can do what you're trying to do w/o finding their code...just do what I told you to do and you'll be good as gold