<?php
/**
* findbrowser - Find Clients Browser
* Copyright (C) 2009 Dean Gardiner <http://www.winmastergames.com> <hide@address.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
class findbrowser {
//Declare variables
private $useragent;
private $Browser;
private $BrowserSplit;
private $Machine;
private $mach;
private $small;
//Start Construct
public function __construct() {
//Get clients Useragent
$this->useragent = $_SERVER['HTTP_USER_AGENT'];
$this->Browser = $this->useragent;
$this->BrowserSplit = explode("/", $this->useragent);
$this->Machine = $this->BrowserSplit[2];
}
//get_browser() Method
public function get_browser() {
//Firefox
$this->mach = explode(" ", $this->BrowserSplit[2]);
//Internet Explorer
if (empty($this->mach[1])) {
$this->mach = explode(";", $this->BrowserSplit[1]);
}
//Opera
if (strlen($this->mach[1]) <= 5) {
$this->mach = explode("/", $this->useragent);
return $this->mach[0];
exit;
}
return $this->mach[1];
}
}
?>