homepage Welcome to WebmasterWorld Guest from 54.205.189.156
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
variable not getting read?
iggy99




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

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




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

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




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

yep - fixed

thank you

:)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved