hexydec /
agentzero
| 1 | <?php |
||
| 2 | require(__DIR__.'/src/autoload.php'); |
||
| 3 | |||
| 4 | if (!empty($_POST['ua'])) { |
||
| 5 | $ua = $_POST['ua']; |
||
| 6 | } else { |
||
| 7 | $ua = $_SERVER['HTTP_USER_AGENT']; |
||
| 8 | } |
||
| 9 | $time = \microtime(true); |
||
| 10 | $output = \hexydec\agentzero\agentzero::parse($ua); |
||
| 11 | $total = \microtime(true) - $time; |
||
| 12 | ?> |
||
| 13 | <!DOCTYPE html> |
||
| 14 | <html> |
||
| 15 | <head> |
||
| 16 | <title>AgentZero - User Agent Information Test Page</title> |
||
| 17 | <meta name="viewport" content="width=device-width,initial-scale=1.0" /> |
||
| 18 | <style> |
||
| 19 | .content { |
||
| 20 | max-width: 1280px; |
||
| 21 | margin: 0 auto; |
||
| 22 | } |
||
| 23 | |||
| 24 | .form__control { |
||
| 25 | display: flex; |
||
| 26 | padding: 5px 0; |
||
| 27 | } |
||
| 28 | |||
| 29 | .form__label { |
||
| 30 | flex: 0 0 25%; |
||
| 31 | box-sizing: border-box; |
||
| 32 | padding-right: 10px; |
||
| 33 | text-align: right; |
||
| 34 | } |
||
| 35 | |||
| 36 | .form__input { |
||
| 37 | flex: 1 1 auto; |
||
| 38 | } |
||
| 39 | |||
| 40 | .form__submit { |
||
| 41 | margin-left: 25%; |
||
| 42 | width: 40%; |
||
| 43 | } |
||
| 44 | </style> |
||
| 45 | </head> |
||
| 46 | <body> |
||
| 47 | <main class="content"> |
||
| 48 | <h1>AgentZero User Agent Information</h1> |
||
| 49 | <form accept-charset="<?= \htmlspecialchars(\mb_internal_encoding()); ?>" method="post"> |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 50 | <div class="form__control"> |
||
| 51 | <label class="form__label">User Agent:</label> |
||
| 52 | <input type="text" class="form__input" name="ua" value="<?= \htmlspecialchars($ua); ?>" /> |
||
| 53 | </div> |
||
| 54 | <div class="form__control"> |
||
| 55 | <input type="submit" class="form__submit" value="Get Info" /> |
||
| 56 | </div> |
||
| 57 | </form> |
||
| 58 | <?php if ($output !== null) { ?> |
||
| 59 | <pre><?= htmlspecialchars(print_r(\array_filter((array) $output), true)); ?></pre> |
||
| 60 | <p>Generated in <?= \number_format($total, 5); ?></p> |
||
| 61 | <?php } ?> |
||
| 62 | </main> |
||
| 63 | </body> |
||
| 64 | </html> |