Forum Moderators: coopster
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]
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.