Welcome to WebmasterWorld Guest from 50.19.34.234

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

variable not getting read?

     

iggy99

12:23 am on Aug 22, 2006 (gmt 0)

10+ Year Member



we are having huge problems...

just moving to new web server

something must be set incorrectly...

seems php is not able to 'see' and interpert variables...

this simple php snippet should show 'mozilla' when used with explorer or forefox

not working = shows 'other' should show 'mozilla'

<?php
if (!(strpos($HTTP_USER_AGENT,'Mozilla/5') === false)) {
echo("mozilla<!-- Mozilla specific code -->");
} else {
echo("other<!-- Code for other browsers -->");
}
?>

this is messing up everything - form variables are not passed either

thoughts?

[edited by: jatar_k at 5:30 pm (utc) on Aug. 22, 2006]
[edit reason]
[1][edit reason] no urls thanks [/edit]
[/edit][/1]

Gibisan

1:27 am on Aug 22, 2006 (gmt 0)

10+ Year Member



I have just been through the same thing and believe your problem lies with register_globals - [au2.php.net...]

On your new server you will probably find register_globals set to Off where it was previously set to On on your old server.

You'll probably find this gives the right result to your script -

if (!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
echo("mozilla<!-- Mozilla specific code -->");
} else {
echo("other<!-- Code for other browsers -->");
}

You can just turn register_globals on in your php.ini but there are security issues around this which is why it is no longer the default in php.ini
I suggest changing your scripts to get at the form variables $_GET / $_POST - have a read around.

iggy99

4:44 am on Aug 22, 2006 (gmt 0)

10+ Year Member



yep - fixed

thank you

:)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month