View previous topic :: View next topic |
Author |
Message |
mythix -
Joined: 13 Jun 2002 Posts: 20 Location: UK - Frome
|
Posted: Fri Dec 06, 2002 12:56 pm Post subject: Session varaibles to error documents? |
|
|
Hi,
i am setting up a site that has the ability to alter text size by setting it as a session varaible. In the php.ini I have included a header to prepend, this then selects the appropriate text size (actually picks a css file but anyways), If i have the text size set to large or extra large then get an error message such as 404, the headers appear just fine, but thye don't pick up the fact that it should be displaying large or extra large text.
Is this becuase apprellium stops sessions or somthing when sending to an error doc?
Thanks |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Dec 06, 2002 1:33 pm Post subject: Re: Session varaibles to error documents? |
|
|
mythix wrote: | Hi,
i am setting up a site that has the ability to alter text size by setting it as a session varaible. In the php.ini I have included a header to prepend, this then selects the appropriate text size (actually picks a css file but anyways), If i have the text size set to large or extra large then get an error message such as 404, the headers appear just fine, but thye don't pick up the fact that it should be displaying large or extra large text.
Is this becuase apprellium stops sessions or somthing when sending to an error doc?
Thanks |
Abyss Web Server don't stop any session variable. Session variables are a mechanism managed by PHP and the web server has no responsibility to do that.
The problem is that if you define a static error page for 404 error, this page won't get your session variables as it isn't PHP powered (because these session variables are a PHP thing.) So create your own PHP page for the 404 error.
If you think we haven't understood the problem, feel free to give us more details or send us the scripts/pages of your web site (just the relevant ones) in a Zip file to support@aprelium.com. We will have a look and them and give you an advice/check the problem. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
mythix -
Joined: 13 Jun 2002 Posts: 20 Location: UK - Frome
|
Posted: Fri Dec 06, 2002 2:12 pm Post subject: |
|
|
The error page is a php page :(
error.php d'oh
here's a copy of the code I use in the header, where base.css = standard sized, basel.css = large and basexl = xtra large:
Code: |
<?php
//start or continue sessiosn
session_start();
//choose font sizes
if (isset($HTTP_SESSION_VARS[fontcss])) {
$fontcss = $HTTP_SESSION_VARS[fontcss];
} else {
$fontcss = "base.css";
}
?>
<HTML>
<HEAD>
<TITLE>
WRITHLINGTON.school
</TITLE>
<script src="../inc/fade.js" type="text/javascript"></script>
<STYLE TYPE="text/css">
<!--
a {text-decoration: none;}
-->
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="http://<?=$HTTP_SERVER_VARS['SERVER_NAME']?>/<?=$fontcss?>" type="text/css">
</HEAD> |
I can't see anything wrong with it! And it works with ALL the other pages concerned and yes php is definitley assigned to work along with the .php extension, hmmm ponders, but can't think of any reasoning??? |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sat Dec 07, 2002 8:06 am Post subject: |
|
|
Hmm... We think that we understand the problem and it is really very complex. If you are redirecting the 404 error to error.php using a relative URL (say 404 error is associated to /error.php) then the web server does an internal redirection of the wrong request. Headers of the original request (the wrong one) are not passed as is to the error page but a REDIRECT_ string is preprended to their names (This is explained in the documentation in the CGI section.)
The original Cookies header (of the wrong request, it is referenced by $_SERVER['HTTP_COOKIES']) is then passed to your error.php as an environment variable that name is REDIRECT_HTTP_COOKIES ($_SERVER['REDIRECT_HTTP_COOKIES']). PHP can't recognize it as a valid cookies header when retrieving your session variables.
So what to do? You can force an external redirection of the error. Associate 404 error with http://yoursite/error.php. Doing so will tell the server to force the browser to redirect to the error page without doing a server internal redirection. You can also tell your script to put the contents of REDIRECT_HTTP_COOKIES variable in Cookies header before decoding the session variables.
Your feedback is welcome _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
|