Commit | Line | Data |
---|---|---|
b8db1df4 | 1 | <?php |
39814159 | 2 | include('../classes/useragent.php-class'); |
1c666195 | 3 | |
9c17eb15 RK |
4 | // set default time zone - right now, always the one the server is in! |
5 | date_default_timezone_set('Europe/Vienna'); | |
6 | ||
39814159 RK |
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"); | |
13 | ||
14 | if (strlen($_REQUEST["ua"])) { | |
15 | $ua = new userAgent($_REQUEST["ua"]); | |
b8db1df4 | 16 | } |
17 | else { | |
18 | $ua = new userAgent; | |
19 | } | |
20 | ||
39814159 | 21 | print("<h1>User Agent Test</h1>\n"); |
b8db1df4 | 22 | |
1c666195 | 23 | print("I read the following user agent string from ".(strlen($httpvars["ua"])?"your input":"your browser").":\n<br>"); |
e742e507 | 24 | print("<b>".$ua->getUAString()."</b>\n"); |
b8db1df4 | 25 | |
e742e507 | 26 | print("<br><br>The browser brand is reported as "<b>".$ua->getBrand()."</b>"\n"); |
726d345a | 27 | print("<br>The browser version is reported as "<b>".$ua->getVersion()."</b>"\n"); |
e742e507 | 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"); | |
a3e499ad RK |
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"); | |
36 | } | |
726d345a | 37 | print("<br><br>I conclude this must be <b>".$ua->getBrand()." ".$ua->getVersion()."</b>\n"); |
e742e507 | 38 | print("<br>This is <b>".($ua->isBot()?"an":"no")."</b> automated robot.\n"); |
39 | ||
40 | $acclang = $ua->getAcceptLanguages(); | |
41 | print("<br><br>Accepted Languages: "); | |
42 | foreach ($acclang as $lang=>$q) { print($lang."(".$q.") "); } | |
43 | print("\n"); | |
b8db1df4 | 44 | |
1c666195 | 45 | print("<br><br>Test the following UA string (leave empty to read it from your browser):\n"); |
b8db1df4 | 46 | print("<form method=\"POST\" action=\"\"><p>\n"); |
4a778b7e | 47 | print("<input type=\"text\" name=\"ua\" value=\"".htmlentities($ua->getUAString())."\" size=\"80\" maxlength=\"150\">\n"); |
b8db1df4 | 48 | print("<br><input type=\"submit\" value=\"Test\"></p></form>\n"); |
39814159 RK |
49 | |
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"); | |
52 | print("</div>\n"); | |
53 | print("</body></html>\n"); | |
b8db1df4 | 54 | ?> |