Html4newbies
Put your hands into html and php
Home
Privacy
About
Contact

News Feed
Newsfeed
Free Php Snippets
Php Snippets 1
Php Snippets 2
What browser the visitor is using

Digital Download Store

What browser the visitor is using
<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>



Output:
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

Is the visitor using MSIE
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
?>
<h3>strpos() must have returned non-false</h3>
<p>You are using Internet Explorer</p>
<?php
} else {
?>
<h3>strpos() must have returned false</h3>
<p>You are not using Internet Explorer</p>
<?php
}
?>



Output:

strpos() must have returned false

You are not using Internet Explorer


Here we used strpos with a if statement
If a visitor is using MSIE then returns true else it returns false.

Copyright © 2002-2008 Html4newbies - HarlandScripts.com NetWork  ( 177 )