you can turn register globals off using htaccess, i dont have an example for
you but that should fix it.

-----Original Message-----
From: Terry Romine [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 22, 2004 10:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP] set global working??


Not quite a mystery, but I wondered if anyone could throw a couple of
suggestions my way.

My client's websites were moved last year from an old php server to a
newer one. At that time, I had to upgrade all her scripts because
set_globals were off on the new server, and so I went to using
$_SESSION variables. All seemed to be doing fine until sometime last
week when the scripts on a new website I am working on, being hosted on
her server, started flaking out. Variables were becoming persistent,
retaining previous values and refusing to change.

I checked the php settings and found that the version running on the
sever is 4.1.2 with globals on. That surprised me. I don't have admin
access and would be cautious about trying to change this and possibly
messing up someone else's site.

Anyway, to test my theory, I created a simple script that turns
session_start on and off. If session_start is off, variables work fine.
With session_start on, variable will change once, and then refuse to
change. I've attached the script.

Does this indeed mean that I have to go through all my scripts and
comment out session_start and convert my $_SESSION defines back??
Yeachh!!

Terry

<?
        if($pers)
                session_start();
        // check for persistance
        if(!$ag) $ag=8; // set as default
        switch($ag){
                case "8": $office="Modesto"; break;
                case "7": $office="Livermore";break;
                case "9": $office="Fremont"; break;
                case "10": $office="San Lorenzo"; break;
                case "28": $office="Berkeley"; break;
                case "25": $office="Mountain View"; break;
        }
        if($switch) $pers=(!$pers);             // switch persistence on/off
?>

                <div align="center"><font size="5" color="#00015d"
face="Verdana"><b><?=$office?></b></font></div></td>
                <br />
                <a href="check.php?ag=<?=$ag?>&pers=<?=$pers?>&switch=1">Switch
Persistence <?=$pers?></a>
                <br />
                <a href="check.php?ag=7&pers=<?=$pers?>">Livermore</a>
                <a href="check.php?ag=8&pers=<?=$pers?>">Modesto</a>
                <a href="check.php?ag=9&pers=<?=$pers?>">Fremont</a>
                <a href="check.php?ag=10&pers=<?=$pers?>">San Lorenzo</a>
                <a href="check.php?ag=28&pers=<?=$pers?>">Berkeley</a>
<br />


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to