Check String and User Agent
This is what i do to check out that stuff:
if(strlen(strstr($_SERVER['HTTP_USER_AGENT'],"Firefox")) <= 0 ){ // if not firefox
//do something
}
And added into your code:
function get_user_browser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$ub = '';
if(strlen(strstr($u_agent,"Firefox")) > 0 ){
$ub = 'firefox';
}
else {
$ub = 'other';
}
return $ub;
}
if (isset($_GET['print']) && $_GET['print'] != ""
&& get_user_browser() == 'firefox')
{
$pg = $_GET['print'];
if (!file_exists('1'))
{
echo '<b>It worked!</b>';
}
}
else
{
echo '';
}
Detecting the users browser with the User Agent String
You may try to check this Browser detection using the user agent
The most common reason to perform user agent sniffing is to determine
which type of device the browser runs on.
UserAgent String information for knowing the plugins or extensions installed on the requesting browser?
I found this site.
It has many user agents. I went through many Useragents and finally I could see that in older browser versions of IE and Opera the name of the plugins/extensions were present.
In Chrome and Firefox I could not find any such imprints.
How to retrieve exact user-agent string from Google Analytics
The best you're going to get out of the Data Export API (or the Google Analytics interface) is processed information: browser / browser version (Internet Explorer / 8.0). There is no way to get the original user-agent string.
Also note that if you have a high volume website you're going to run into data sampling especially if you're looking at a date range beyond larger than a day or two (more on sampling).
Related Topics
Get All Work Days in a Week for a Given Date
How to Get List of Supported Encodings by Iconv Library in PHP
PHP - How to Translate a Website into Multiple Languages
PHP Making a Download Counter Without Leaving the Current Page
Get a Single Row from the Database Using Ajax in Codeigniter
How to Hide PHP File Extension Without Using .Htaccess
Send Email with Attachments in PHP
How to Take a Screenshot of a Website with PHP and Gd
Mod_Rewrite to Remove .PHP But Still Serve the .PHP File
PHP MySQLi Commands Out of Sync; You Can't Run This Command Now
PHP - Make Multi-Dimensional Associative Array from a Delimited String
Set the Option Available for Select Based on Another Select PHP