add Safari for Windows, better Safari detection, more consistency for Symbian
[php-utility-classes.git] / testbed / ua_test.php
CommitLineData
b8db1df4 1<?php
2$inc_class_util = true;
3$inc_class_ua = true;
32412c2a 4include("inchandler.inc");
b8db1df4 5
1c666195 6$wrapper->pgtop("KaiRo's Browser-Test");
7
b8db1df4 8$httpvars = $util->getHTTPvars();
9if (strlen($httpvars["ua"])) {
10 $ua = new userAgent($httpvars["ua"]);
11}
12else {
13 $ua = new userAgent;
14}
15
16print("<h1>KaiRo's Browser-Test</h1>\n");
17
1c666195 18print("I read the following user agent string from ".(strlen($httpvars["ua"])?"your input":"your browser").":\n<br>");
e742e507 19print("<b>".$ua->getUAString()."</b>\n");
b8db1df4 20
e742e507 21print("<br><br>The browser brand is reported as &quot;<b>".$ua->getBrand()."</b>&quot;\n");
726d345a 22print("<br>The browser version is reported as &quot;<b>".$ua->getVersion()."</b>&quot;\n");
e742e507 23print("<br>The browser engine is reported as &quot;<b>".$ua->getEngine()."</b>&quot;\n");
24print("<br>The engine version is reported as &quot;<b>".$ua->getEngineVersion()."</b>&quot;\n");
25print("<br>The operating system is reported as &quot;<b>".$ua->getOS()."</b>&quot;\n");
26print("<br>The system platform is reported as &quot;<b>".$ua->getPlatform()."</b>&quot;\n");
27print("<br>The browser language is reported as &quot;<b>".$ua->getLanguage()."</b>&quot;\n");
4a778b7e 28if ($ua->hasEngine('gecko')) { print("<br>The Gecko date is reported as &quot;<b>".$ua->getGeckoDate()."</b>&quot;\n"); }
726d345a 29print("<br><br>I conclude this must be <b>".$ua->getBrand()." ".$ua->getVersion()."</b>\n");
e742e507 30print("<br>This is <b>".($ua->isBot()?"an":"no")."</b> automated robot.\n");
31
32$acclang = $ua->getAcceptLanguages();
33print("<br><br>Accepted Languages: ");
34foreach ($acclang as $lang=>$q) { print($lang."(".$q.") "); }
35print("\n");
b8db1df4 36
1c666195 37print("<br><br>Test the following UA string (leave empty to read it from your browser):\n");
b8db1df4 38print("<form method=\"POST\" action=\"\"><p>\n");
4a778b7e 39print("<input type=\"text\" name=\"ua\" value=\"".htmlentities($ua->getUAString())."\" size=\"80\" maxlength=\"150\">\n");
b8db1df4 40print("<br><input type=\"submit\" value=\"Test\"></p></form>\n");
1c666195 41$wrapper->pgbottom();
b8db1df4 42?>