PHP Classes

File: app/vendor/foroco/php-browser-detection/tests/v2.2.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   PHP IP Logger   app/vendor/foroco/php-browser-detection/tests/v2.2.php   Download  
File: app/vendor/foroco/php-browser-detection/tests/v2.2.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP IP Logger
Track user IP addresses that access certain pages
Author: By
Last change:
Date: 1 year ago
Size: 1,237 bytes
 

Contents

Class file image Download
<?php

require_once('../src/BrowserDetection.php');
$Browser = new foroco\BrowserDetection();

// Testing some new User-Agent strings

$useragent[] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36';
$useragent[] = 'Mozilla/5.0 (Windows NT 10.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36';
$useragent[] = 'Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36';

$time_start = microtime(true);

foreach (
$useragent as $u)
{
   
// Detect all possible environment data from User-Agents
   
$result = $Browser->getAll($u);

    echo
'<div style="font-size:16px; font-weight:bold"><pre>';
    echo
$u;
    echo
'</pre></div>';

    echo
'<div style="font-size:18px; font-weight:bold"><pre>';
   
print_r($result);
    echo
'</pre></div>';

    echo
'<div style="font-size:16px; font-weight:bold"><pre>';
    echo
'--------------------------------------------------------------------------------';
    echo
'</pre></div>';

}

$time_end = microtime(true);
$time_result = $time_end - $time_start;

echo
'<p style="font-size:21px">Total execution time: '.substr($time_result,0,7).' sec.</p>';

?>