Forum Moderators: coopster

Message Too Old, No Replies

Difference between PHP Version 4.3.11 and PHP Version 4.3.1

On Session Variables

         

Francis

2:38 pm on Apr 22, 2005 (gmt 0)

10+ Year Member



Our host currently migrated to PHP Version 4.3.11.

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.

dcrombie

3:17 pm on Apr 22, 2005 (gmt 0)



This code:

<?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.

;)

jatar_k

5:36 pm on Apr 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



all that code should be is

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?

Francis

11:47 pm on Apr 23, 2005 (gmt 0)

10+ Year Member



Hi everybody.

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.

coopster

2:50 am on Apr 27, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hehe, you don't know how many times each of wish there was something we could use from the server-side to fix browser issues. Sorry, Francis, we are at the mercy of the browser.