cookie variables and included files
Posted: Fri May 14, 2004 12:38 pm
Can anyone tell me why...
when a user logs into my site, a cookie is created that holds some info. The user is then taken to the default index page (index.php).
Some menu options on this page call the index.php page again, and pass variables via the URL query string. (index.php?action=sports)
Now index.php is still used to generate the menus, but action=sports causes a page to be included (<?php include ('http://www.domain.com/sports.php?cat=0'); ?>
Because the include has a query string on the URL, the http part is required, without it php tries to find a page named 'sports.php?cat=0' and not a page named 'sports.php' with a quiry string of 'cat=0.'
Okay, now the problem. Using the fully qualified URL (with the http part) the included page can not see the cookie. It treats the user as if they are not logged in... the index.php page still knows they are there, but the included page asks them to login.
- it is all under the same domain name.
- both pages are set to use the same cookie.
Can anyone suggest a work around? A different way to include the file? Anything else?
Thanks!
when a user logs into my site, a cookie is created that holds some info. The user is then taken to the default index page (index.php).
Some menu options on this page call the index.php page again, and pass variables via the URL query string. (index.php?action=sports)
Now index.php is still used to generate the menus, but action=sports causes a page to be included (<?php include ('http://www.domain.com/sports.php?cat=0'); ?>
Because the include has a query string on the URL, the http part is required, without it php tries to find a page named 'sports.php?cat=0' and not a page named 'sports.php' with a quiry string of 'cat=0.'
Okay, now the problem. Using the fully qualified URL (with the http part) the included page can not see the cookie. It treats the user as if they are not logged in... the index.php page still knows they are there, but the included page asks them to login.
- it is all under the same domain name.
- both pages are set to use the same cookie.
Can anyone suggest a work around? A different way to include the file? Anything else?
Thanks!