Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if netscape 4.x....

Status
Not open for further replies.

gameon

Programmer
Feb 23, 2001
325
GB
Hi I usually use cold fusion, but I'm doing a project with php.

I'm not completly lost, but cannot implement my fav functions.

How do you do an:

<if Netscape 4.x>
do this
<else>
do that
</if>

Cheers if you can help me...

M@)
 
Assuming that you are running PHP as a web server module, the data you need can be found in the predefined variable $_SERVER['HTTP_USER_AGENT'] ______________________________________________________________________
TANSTAAFL!
 
Ok, so in my statement I go:

<?php
if(stristr($_SERVER['HTTP_USER_AGENT'],&quot;Netscape 4&quot;)){
print &quot;do netscape 4.x stuff&quot;;
}else{
print &quot;do other stuff&quot;;
}?>

But I don't know what string is in $_SERVER['HTTP_USER_AGENT'],&quot; for netscape 4.

How do I output the var '$_SERVER['HTTP_USER_AGENT']' to have a look?

Cheers

M@)
 
I'm also a PHP neophyte with a history in ColdFusion. I definitely like PHP better, don't you? Try this to detect Netscape 4:
Code:
<?php
  $isNav4 = preg_match(&quot;/^Mozilla\/4/&quot;,$GLOBALS[&quot;HTTP_USER_AGENT&quot;]) && !preg_match(&quot;/MSIE/&quot;,$GLOBALS[&quot;HTTP_USER_AGENT&quot;]);
?>

<?php if($isNav4){ ?>
  do one thing
<?php } else { ?>
  do another
<?php } ?>
 
I so agree, but would like to be flexible. I suppose is because I started with cf.

So that does:

isNav4 is true is Mozilla4 and NOT MSIE is contained within $GLOBALS[&quot;http_USER_AGENT&quot;]

Cool

Cheers,

M@)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top