Time for a coffee me thinks
Cookies.....Oatmeal Or Peanut Butter?
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
I took the s off of COOKIES and it still isn't displaying anything. I put that script in a test page to see if it would display the contents of the cookie (I've only used the echo statement, but knowing how to program in BASIC I'm guessing print_r was supposed to display the value for $data). Is that script not supposed to display the cookie's information?d11wtq wrote: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);
Put this at the top of the pages you want to get user data from. Then you can get all the info you want out of the $userdata variable if the user is logged in.
Hope this helps.
Code: Select all
/////SET UP PHPBB VARIABLES AND USER DATA
define('IN_PHPBB', true);
$phpbb_root_path = 'ABSOLUTE/PATH/TO/YOUR/forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
[Also, PEANUT BUTTER ROXXORS!!!]
Code: Select all
if($user_data['user_logged_in']){
//do something
}else {
//do something else
}-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
I already got that far because I went through with the "Sharing sessions outside of phpBB" guide on the phpbb.com kb. Thanks for telling me, though. As far as checking if the user is logged in, I'm already doing it that way. I think my code is only checking the session, though, instead of the cookie. I'll post what my login test page PHP coding is, then maybe you can tell me how to implement your code into it. I might be able to figure it out, but just to make sure I don't screw it up...neophyte wrote:Yuppers, I implemented it before. Implementing an external login can be done this way too. All you have to do to see if a user is logged in is:
I'm pretty sure that will do it for you. If not it's because 'user_logged_in' is the wrong key. var_dump($user_data); to see the multitude of variables available to you throught this variable.Code: Select all
if($user_dataї'user_logged_in']){ //do something }else { //do something else }
Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
//
// Check For Logged In
//
if( $userdataї'session_logged_in'] )
{
echo "e;Welcome to ZD!"e;;
}
else
{
echo('Please Login');
include("e;includes/login.php"e;);
}
//
// End Login Check
//
?>Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);[/php your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);[php:1:f23b60c7b. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:
Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_dataes. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);To see what you are getting.n.com and domain.com and subdomain.mydomain.com (I think). phpBB doesn't use session cookies. Just the regular $_COOKIE variables. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see whyfiguration db. Make sure it is .yourdomain.com the dot in the front is important. You'll have access to cookies with http://www.yourdomain.com and domain.com and subdomain.mydomain.com (I think). phpBB doesn't use session cookies. Just the regular $_COOKIE variables. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:
Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);[/php:1:f23bonfiguration db. Make sure it is .yourdomain.com the dot in the front is important. You'll have access to cookies with http://www.yourdomain.com and domain.com and subdomain.mydomain.com (I think). phpBB doesn't use session cookies. Just the regular $_COOKIE variables. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);[/phpont is important. You'll have access to cookies with http://www.yourdomain.com and domain.com and subdomain.mydomain.com (I think). phpBB doesn't use session cookies. Just the regular $_COOKIE variables. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_Ck). phpBB doesn't use session cookies. Just the regular $_COOKIE variables. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);[phpoesn't use session cookies. Just the regular $_COOKIE variables. Double check your address bar if you login using your custom script make sure you come back to the same domain name as when you logged in. I don't see why your script wouldn't work other than you not getting access to the $_COOKIE variables. For testing I'd add:
Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);Code: Select all
var_dump($user_data);-
joetheeskimo5
- Forum Commoner
- Posts: 43
- Joined: Sun Dec 14, 2003 4:47 pm
- Location: US
- Contact:
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Majoraslayer wrote: 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?
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;echo $normaldata;
that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$da"Majoraslayer"]
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?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;Code: Select all
$data = $_COOKIE['phpbb2mysqd into my forum. Any reason why that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIEї'phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialrks:Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;$normaldata = unserialize($data);
echo $normaldata;
ayed when I print or echo $data. I know I have that cookie because I'm logged into my forum. Any reason why that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;
[/php:1but try this instead and see if it works:Code: Select all
$data = $_COOKIEї'phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I caothing 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?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$dataaslayer"]
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?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIEї'en I print or echo $data. I know I have that cookie because I'm logged into my forum. Any reason why that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normalI know I have that cookie because I'm logged into my forum. Any reason why that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIEї'phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;
[/php:1:257l, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;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?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;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?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIEї'phpbb2mysql_data'];
$normaldata = unserialize($dahave that cookie because I'm logged into my forum. Any reason why that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIE['phpbb2 don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;
or echo $data. I know I have that cookie because I'm logged into my forum. Any reason why that is?[/quote]
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;echo $normaldata;
n't know if I can call it buggy, but try this instead and see if it works:
Code: Select all
That code is unusual, I don't know if I can call it buggy, but try this instead and see if it works:Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;Code: Select all
$data = $_COOKIE['phpbb2mysql_data'];
$normaldata = unserialize($data);
echo $normaldata;-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
I appreciate all the help! Well, I have another task to work on with this script so I may just start a new topic for it. If anyone knows the variable I need to check for the user level in phpBB, could you tell me? Thanx!