penname
asked on
Pass PHP Session between virtual directories on same domain on IIS
I have a website
http://www.maindomain.com/virtualDirectory1/login.php
I create session variables on this site that contains user rights.
I have a link to another site on same domain
http://www.maindomain.com/virtualDirectory2/home.php
how can I pass session variables to this second site that were established in the first site?
http://www.maindomain.com/virtualDirectory1/login.php
I create session variables on this site that contains user rights.
I have a link to another site on same domain
http://www.maindomain.com/virtualDirectory2/home.php
how can I pass session variables to this second site that were established in the first site?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nevermind when i put in the fully qualified domain name it works. Thanks.
@penname: Thanks for the points - it's a great question, and I'm glad you got it working! ~Ray
ASKER
Your code works but I found something that I have a question about.
I am currently testing this on a development server. It is simply named dev. When I use your code as is, it won't work.
But when I leave out the domain parameter it works.
Works:
setCookie($cookie_name, $cookie_value, $cookie_expires, $cookie_path);
Does not work:
setcookie($cookie_name, $cookie_value, $cookie_expires, $cookie_path, $cookie_domain, $cookie_secure, $cookie_http)
How can I get the domain parameter to work when i don't have something like domain.com/VirtualDirector
Setting the cookie_path seemed to be the key to getting it to work. Previously I was only setting the first 2 parameters. Still wondering about why I can't add the domain param...