Jump to content

SEMI-SOLVED: Sessions and Cookies Not Global?


MrFish

Recommended Posts

I have a site with a directory called IFP. In the IFP/admin/ directory the administrators login and should be able to go back to the IFP while keeping their administrative identity. For some reason settings sessions or cookies in the admin directory doesn't register in the previews IFP directory. Any ideas why that might be?

Edited by MrFish
Link to comment
Share on other sites

Can you successfully echo $_SESSION or $_COOKIES? EDIT: In a var_dump()?

Edited by niche
Link to comment
Share on other sites

use

echo '<pre>'.print_r(session_get_cookie_params(),true) . '</pre>';

what does it prints? check the 'path of cookies. http://in3.php.net/manual/en/function.session-get-cookie-params.php

  • Like 1
Link to comment
Share on other sites

use
echo '<pre>'.print_r(session_get_cookie_params(),true) . '</pre>';

what does it prints? check the 'path of cookies. http://in3.php.net/m...okie-params.php

In the IFP directory
Array(	[lifetime] => 0	[path] => /	[domain] =>	[secure] =>	[httponly] =>)

in the IFP/admin/ directory

Array(	[lifetime] => 0	[path] => /	[domain] =>	[secure] =>	[httponly] =>)

Can you successfully echo $_SESSION or $_COOKIES?EDIT:In a var_dump()?
a var_dump of my sessions (I'm logged out) In the IFP dir
array(4) { ["adminId"]=> string(1) "2" ["loggedin"]=> bool(true) ["adminPass"]=> string(9) "***hidden***" ["action"]=> string(4) "edit" }

In the IFP/admin dir

NULL

var_dump of the cookies in the IFP dir

array(3) { ["PHPSESSID"]=> string(26) "b2n67ubavlvro10dj7if9sjjv3" ["adminId"]=> string(1) "2" ["adminPass"]=> string(9) "***hidden***" }

in the IFP/admin dir

array(3) { ["PHPSESSID"]=> string(26) "9bq4ht9rv197l0pno1rsehcc16" ["adminId"]=> string(1) "2" ["adminPass"]=> string(9) "***hidden***" }

The PHPSESSID are different. Could that have something to do with it?

Edited by MrFish
Link to comment
Share on other sites

I was able to get it working for now by passing the session id in the url to the page I need admin access. This works for my situation but it would be nice to know why I'm having this problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...