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

Hosting Links
Hosting
Free Php Snippets
Php Snippets 1
Php Snippets 2
What browser the visitor is using


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



Output:
CCBot/2.0 (http://commoncrawl.org/faq/)

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-2017 Html4newbies - Html4newbies.com NetWork