Forum Moderators: coopster
Is there a difference in which PHP Version 4.3.11 handles session variables?
Because prior to migration our PHP scripts worked without a hitch. For example, consider the script below:
?php
/* Determine whether member is logged in or not and display corresponding graphic message */
if (!isset($_SESSION['member_name'])) {?>
<IMG SRC="<?php $_SERVER['DOCUMENT_ROOT']?>/images_submenu/status_guest.jpg" WIDTH=105 HEIGHT=23 ALT="">
<?php } else {?>
<IMG SRC="<?php $_SERVER['DOCUMENT_ROOT']?>/images_submenu/status_logged.jpg" WIDTH=105 HEIGHT=23 ALT="">
<?php }?>
The script is suppose to display a LOGGED-IN status whenever a user has correctly logged-in on the site validated by the (!isset($_SESSION['member_name'])).
But now, after processing the validation through a form on the index page (reads the MySQL DB and checks), the variables seems to be lost when it goes back to the index page. Validation is done through a separate script file.
Local testing works perfectly. We are using the following specs:
1. Windows XP Pro
2. Apache 2.0.48
3. PHP Version 4.3.1
4. MySQL 3.23.55
Any ideas? Thanks again.
<?php $_SERVER['DOCUMENT_ROOT']?>
does absolutely nothing. Which is just as well because the DOCUMENT_ROOT isn't relevant for the browser - only to the file system.
You should check phpinfo() to see if the settings for sessions, or register_globals, etc have changed.
;)
if (!isset($_SESSION['member_name'])) {?>
<IMG SRC="/images_submenu/status_guest.jpg" WIDTH=105 HEIGHT=23 ALT="">
<?php } else {?>
<IMG SRC="/images_submenu/status_logged.jpg" WIDTH=105 HEIGHT=23 ALT="">
<?php }?>
the images will resolve as long as they are root relative, so start with a / and have the absolute path from there.
>> the variables seems to be lost
which variables? the session?
also what are the differences between your local and remote setups. I understand the 4.3.1 and 4.3.11 diff but are they both windows, are they both confgured the same?
Thanks for the reply. I printed out my PHP 4.3.1 configuration as well as our hosts PHP 4.3.11 configuration but there was not much difference.
However, I tried using another PC and checked again, the whole problem has been resolved. Meaning, the log-in display is working.
I tried clearing my browser's cache and deleting all temporary internet files. That solved the problem.
Now, my question is, is there a header command that would automatically do this for me? Or a header command that will automatically load the server's content without basing the site on the content of the local PC?
Hope this makes sense. Thanks again and more power.