2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 include('../classes/useragent.php-class');
8 // set default time zone - right now, always the one the server is in!
9 date_default_timezone_set('Europe/Vienna');
11 print("<!DOCTYPE html>\n");
12 print("<html>\n<head>\n");
13 print(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
14 print(" <link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\">\n");
15 print(" <title>".'User Agent Test'."</title>\n");
16 print("</head>\n<body>\n");
18 if (strlen($_REQUEST["ua"])) {
19 $ua = new userAgent($_REQUEST["ua"]);
25 print("<h1>User Agent Test</h1>\n");
27 print("I read the following user agent string from ".(strlen($httpvars["ua"])?"your input":"your browser").":\n<br>");
28 print("<b>".$ua->getUAString()."</b>\n");
30 print("<br><br>The browser brand is reported as "<b>".$ua->getBrand()."</b>"\n");
31 print("<br>The browser version is reported as "<b>".$ua->getVersion()."</b>"\n");
32 print("<br>The browser engine is reported as "<b>".$ua->getEngine()."</b>"\n");
33 print("<br>The engine version is reported as "<b>".$ua->getEngineVersion()."</b>"\n");
34 print("<br>The operating system is reported as "<b>".$ua->getOS()."</b>"\n");
35 print("<br>The system platform is reported as "<b>".$ua->getPlatform()."</b>"\n");
36 print("<br>The browser language is reported as "<b>".$ua->getLanguage()."</b>"\n");
37 if ($ua->hasEngine('gecko')) {
38 print("<br>The Gecko date is reported as "<b>".$ua->getGeckoDate()."</b>"\n");
39 print("<br>The full Gecko date/time is reported as "<b>".date('r',$ua->getGeckoTime())."</b>"\n");
41 print("<br><br>I conclude this must be <b>".$ua->getBrand()." ".$ua->getVersion()."</b>\n");
42 print("<br>This is <b>".($ua->isBot()?"an":"no")."</b> automated robot.\n");
44 $acclang = $ua->getAcceptLanguages();
45 print("<br><br>Accepted Languages: ");
46 foreach ($acclang as $lang=>$q) { print($lang."(".$q.") "); }
49 print("<br><br>Test the following UA string (leave empty to read it from your browser):\n");
50 print("<form method=\"POST\" action=\"\"><p>\n");
51 print("<input type=\"text\" name=\"ua\" value=\"".htmlentities($ua->getUAString())."\" size=\"80\" maxlength=\"150\">\n");
52 print("<br><input type=\"submit\" value=\"Test\"></p></form>\n");
54 print("<div id=\"copyright\">\n");
55 print("Page code under Mozilla Public License, code available at <a href=\"https://github.com/KaiRo-at/php-utility-classes\">GitHub</a>.\n");
57 print("</body></html>\n");