2 include('../classes/useragent.php-class');
4 // set default time zone - right now, always the one the server is in!
5 date_default_timezone_set('Europe/Vienna');
7 print("<!DOCTYPE html>\n");
8 print("<html>\n<head>\n");
9 print(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
10 print(" <link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\">\n");
11 print(" <title>".'User Agent Test'."</title>\n");
12 print("</head>\n<body>\n");
14 if (strlen($_REQUEST["ua"])) {
15 $ua = new userAgent($_REQUEST["ua"]);
21 print("<h1>User Agent Test</h1>\n");
23 print("I read the following user agent string from ".(strlen($httpvars["ua"])?"your input":"your browser").":\n<br>");
24 print("<b>".$ua->getUAString()."</b>\n");
26 print("<br><br>The browser brand is reported as "<b>".$ua->getBrand()."</b>"\n");
27 print("<br>The browser version is reported as "<b>".$ua->getVersion()."</b>"\n");
28 print("<br>The browser engine is reported as "<b>".$ua->getEngine()."</b>"\n");
29 print("<br>The engine version is reported as "<b>".$ua->getEngineVersion()."</b>"\n");
30 print("<br>The operating system is reported as "<b>".$ua->getOS()."</b>"\n");
31 print("<br>The system platform is reported as "<b>".$ua->getPlatform()."</b>"\n");
32 print("<br>The browser language is reported as "<b>".$ua->getLanguage()."</b>"\n");
33 if ($ua->hasEngine('gecko')) {
34 print("<br>The Gecko date is reported as "<b>".$ua->getGeckoDate()."</b>"\n");
35 print("<br>The full Gecko date/time is reported as "<b>".date('r',$ua->getGeckoTime())."</b>"\n");
37 print("<br><br>I conclude this must be <b>".$ua->getBrand()." ".$ua->getVersion()."</b>\n");
38 print("<br>This is <b>".($ua->isBot()?"an":"no")."</b> automated robot.\n");
40 $acclang = $ua->getAcceptLanguages();
41 print("<br><br>Accepted Languages: ");
42 foreach ($acclang as $lang=>$q) { print($lang."(".$q.") "); }
45 print("<br><br>Test the following UA string (leave empty to read it from your browser):\n");
46 print("<form method=\"POST\" action=\"\"><p>\n");
47 print("<input type=\"text\" name=\"ua\" value=\"".htmlentities($ua->getUAString())."\" size=\"80\" maxlength=\"150\">\n");
48 print("<br><input type=\"submit\" value=\"Test\"></p></form>\n");
50 print("<div id=\"copyright\">\n");
51 print("Page code under Mozilla Public License, code available at <a href=\"https://github.com/KaiRo-at/php-utility-classes\">GitHub</a>.\n");
53 print("</body></html>\n");