Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variables don't work when use Javascript to document.location.

Status
Not open for further replies.

srswift

Programmer
Joined
Jan 30, 2004
Messages
3
Location
US
The following problem occurs when a site is being 'forwarded' to the directory in the server where actual files reside.

I store the log-in information as session variables. Then I use Javascript to redirect -> document.location="index.php?page=skipcheckout".

But it destroys all the session variables or does not recognize them.

Same problem occurs when I use Javascript to pop-up a new window. Everything works fine if I access the page directly, without using the short url that is being forwarded to the actual files.

If anybody can please give me some ideas, I would really appreciate it!

Thanks a lot!
~Shamee
 
Questions:
1. Do you call session_start() in all the scripts?
2. How are sessions set up in your PHP? Check phpinfo();
 
Yes, I do call session_start(). And everything works fine if I access the page directly. Sessions don't work properly when a site is being forwarded (with masking) to the server where actual files reside. I learned that it is because when the privacy level is set to medium (which is the default), browser does not accept 3rd party cookies...I'm still clueless how to solve the problem....

Thanks a lot!
 
Have you considered redirecting to the other location (it's on the same server, right?) using the header directive?

If you give more information about why you want to do this then I can probably better understand what it is you want to achieve.
 
We have set up some global files on our server that serves different customers. Customers can have their own domain name and we give them an unique code. Using that code, they forward their domain to our server. So they are not on the same server....

Thanks for you help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top