/******************************************
** 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