WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Browser Detecor Class
Categories : PHP Classes, PHP, HTML Update Picture
Roger Raymond
Date : Jul 12th 2000
Grade : 2 of 5 (graded 3 times)
Viewed : 8386
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Roger Raymond
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

/******************************************
** Description : BrowserDetector
** File Name : browserDetector.php3
** Author : epsilon7 for PHyX8 studios
** Author Email : epsilon7@asphyxia.com
** Created : Thursday, May 11, 2000
** Last Modified : Wednesday, July 12, 2000
** Modified By : epsilon7
*'
INFO:
Returns Browser information
based on HTTP_USER_AGENT

Ported from The Webmonkey JavaScript Source
##BrowserDetector()
##Parses User-Agent string into useful info.
##Source: Webmonkey Code Library
##(http://www.hotwired.com/webmonkey/javascript/code_library/)
##Author: Rich Blaylock
##Author Email: blaylock@wired.com

Usage:
include("browserDetector.php3");
$bd = new BrowserDetector;

Variables:
$bd->BROWSER // Netscape, MSIE, Opera
$bd->PLATFORM // Win95, Unix, Windows 98, Mac, PPC, etc.
$bd->VERSION // MajorVersion.MinorVersion
$bd->MAJORVER // Major Version (before . in version string)
$bd->MINORVER // Minor Version (after . in version string)

'****************************************/
class BrowserDetector
{ var $UA = "";
var $BROWSER = "Unknown";
var $PLATFORM = "Unknown";
var $VERSION = "";
var $MAJORVER = "";
var $MINORVER = "";

/* START CONSTRUCTOR */
function BrowserDetector()
{ $this->UA = getenv(HTTP_USER_AGENT);
$preparens = "";
$parens = "";
$i = strpos($this->UA,"(");
if ($i >= 0)
{ $preparens = trim(substr($this->UA,0,$i));
$parens = substr($this->UA,$i+1,strlen($this->UA));
$j = strpos($parens,")");
if($j>=0)
{ $parens = substr($parens,0,$j);
}
}
else
{ $preparens = $this->UA;
}
$browVer = $preparens;
$token = trim(strtok($parens,";"));
while($token)
{ if($token=="compatible")
{
}
elseif(preg_match("/MSIE/i","$token"))
{ $browVer = $token;
}
elseif(preg_match("/Opera/i","$token"))
{ $browVer = $token;
}
elseif(preg_match("/X11/i","$token") || preg_match("/SunOS/i","$token") || preg_match
("/Linux/i","$token"))
{ $this->PLATFORM = "Unix";
}
elseif(preg_match("/Win/i","$token"))
{ $this->PLATFORM = $token;
}
elseif(preg_match("/Mac/i","$token") || preg_match("/PPC/i","$token"))
{ $this->PLATFORM = $token;
}
$token = strtok(";");
}
$msieIndex = strpos($browVer,"MSIE");
if($msieIndex >= 0)
{ $browVer = substr($browVer,$msieIndex,strlen($browVer));
}
$leftover = "";
if(substr($browVer,0,strlen("Mozilla")) == "Mozilla")
{ $this->BROWSER = "Netscape";
$leftover=substr($browVer,strlen("Mozilla")+1,strlen($browVer));
}
elseif(substr($browVer,0,strlen("Lynx")) == "Lynx")
{ $this->BROWSER = "Lynx";
$leftover=substr($browVer,strlen("Lynx")+1,strlen($browVer));
}
elseif(substr($browVer,0,strlen("MSIE")) == "MSIE")
{ $this->BROWSER = "IE";
$leftover=substr($browVer,strlen("MSIE")+1,strlen($browVer));
}
elseif(substr($browVer,0,strlen("Microsoft Internet Explorer")) == "Microsoft Internet
Explorer")
{ $this->BROWSER = "IE";
$leftover=substr($browVer,strlen("Microsoft Internet Explorer")+1,strlen($browVer));
}
elseif(substr($browVer,0,strlen("Opera")) == "Opera")
{ $this->BROWSER = "Opera";
$leftover=substr($browVer,strlen("Opera")+1,strlen($browVer));
}
$leftover = trim($leftover);
$i=strpos($leftover," ");
if($i > 0)
{ $this->VERSION = substr($leftover,0,$i);
}
else
{ $this->VERSION = $leftover;
}
$j = strpos($this->VERSION,".");
if($j >= 0)
{ $this->MAJORVER = substr($this->VERSION,0,$j);
$this->MINORVER = substr($this->VERSION,$j+1,strlen($this->VERSION));
}
else
{ $this->MAJORVER = $this->VERSION;
}
}
}
/******************************************
** Some Test Results

Testing : Mozilla/4.73 [en] (Win98; U)
Browser : Netscape
Platform : Win98
Version : 4.73
Major Version : 4
Minor Version : 73

Testing : Opera/4.0 (Windows 98;US) Beta 3 [en]
Browser : Opera
Platform : Windows 98
Version : 4.0
Major Version : 4
Minor Version : 0

Testing : Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Browser : IE
Platform : Windows 98
Version : 5.0
Major Version : 5
Minor Version : 0

'****************************************/



Form is a utility class for generating html forms. It provides form initialization and regex based data validation (both server and client side) with a convenient interface. This version obsoletes version 1.0a
Categories : HTML, PHP, PHP Classes, Regexps
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Automatic generation of HTML code for a table. OO interface. Can define colspan, rowspan, table style, cell style, and data style. Simple, but effective.
Categories : PHP, PHP Classes, HTML, HTML and PHP
class formHTML build your HTML Forms from PHP
Categories : PHP, PHP Classes, HTML and PHP, HTML
A simple class with some HTML output functions that would come in handy for consistent page layout etc.
Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation
SPL and ITERATOR : examples
Categories : PHP, Object Oriented, PHP Classes, Sessions
Class: Info on Users, Servers and the running script
Categories : PHP, Classes and Objects, User Interface, PHP Classes
XTemplate, a template class for PHP
Categories : PHP Classes, HTML and PHP, PHP
AutoRSS
Categories : PHP, Rich Site Summary (RSS), PHP Classes
Compare two texts and display a block of text with the differences between them.
Categories : PHP, PHP Classes, Filesystem, Strings, Arrays
A class to put get and post variables in hidden form elements. Works on scalars, normal arrays, associative arrays.
Categories : Algorithms, Variables, Arrays, PHP, PHP Classes
ANTI leech script, use this if you want that people can't see the original URL. The files can be on your own server or on another server.
Categories : HTML, Misc, PHP
XML To Array
Categories : PHP, PHP Classes, XML, Arrays
Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General
Formit 1.0. PHP Very easy to implement form-template(s) to email script. Works with multiple templates and HTML-format email. Only one file!
Categories : PHP, Email, HTML
 Wolli Burg wrote :784
This doesn`t seem to work with opera 6.01 ?
as opera it shows IE as browser