move the files needed for the new php-utility-classes repo into new directories
[php-utility-classes.git] / tests / 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
9c17eb15
RK
8// set default time zone - right now, always the one the server is in!
9date_default_timezone_set('Europe/Vienna');
10
b8db1df4 11$httpvars = $util->getHTTPvars();
12if (strlen($httpvars["ua"])) {
13 $ua = new userAgent($httpvars["ua"]);
14}
15else {
16 $ua = new userAgent;
17}
18
19print("<h1>KaiRo's Browser-Test</h1>\n");
20
1c666195 21print("I read the following user agent string from ".(strlen($httpvars["ua"])?"your input":"your browser").":\n<br>");
e742e507 22print("<b>".$ua->getUAString()."</b>\n");
b8db1df4 23
e742e507 24print("<br><br>The browser brand is reported as &quot;<b>".$ua->getBrand()."</b>&quot;\n");
726d345a 25print("<br>The browser version is reported as &quot;<b>".$ua->getVersion()."</b>&quot;\n");
e742e507 26print("<br>The browser engine is reported as &quot;<b>".$ua->getEngine()."</b>&quot;\n");
27print("<br>The engine version is reported as &quot;<b>".$ua->getEngineVersion()."</b>&quot;\n");
28print("<br>The operating system is reported as &quot;<b>".$ua->getOS()."</b>&quot;\n");
29print("<br>The system platform is reported as &quot;<b>".$ua->getPlatform()."</b>&quot;\n");
30print("<br>The browser language is reported as &quot;<b>".$ua->getLanguage()."</b>&quot;\n");
a3e499ad
RK
31if ($ua->hasEngine('gecko')) {
32 print("<br>The Gecko date is reported as &quot;<b>".$ua->getGeckoDate()."</b>&quot;\n");
33 print("<br>The full Gecko date/time is reported as &quot;<b>".date('r',$ua->getGeckoTime())."</b>&quot;\n");
34}
726d345a 35print("<br><br>I conclude this must be <b>".$ua->getBrand()." ".$ua->getVersion()."</b>\n");
e742e507 36print("<br>This is <b>".($ua->isBot()?"an":"no")."</b> automated robot.\n");
37
38$acclang = $ua->getAcceptLanguages();
39print("<br><br>Accepted Languages: ");
40foreach ($acclang as $lang=>$q) { print($lang."(".$q.") "); }
41print("\n");
b8db1df4 42
1c666195 43print("<br><br>Test the following UA string (leave empty to read it from your browser):\n");
b8db1df4 44print("<form method=\"POST\" action=\"\"><p>\n");
4a778b7e 45print("<input type=\"text\" name=\"ua\" value=\"".htmlentities($ua->getUAString())."\" size=\"80\" maxlength=\"150\">\n");
b8db1df4 46print("<br><input type=\"submit\" value=\"Test\"></p></form>\n");
1c666195 47$wrapper->pgbottom();
b8db1df4 48?>