示例#1
1
 /**
  * Inserts the access log information in
  * the database
  *
  * @param array $alogs Access Log lines
  * @param       $fromServer array The sender of these access logs
  *
  * @throws \Kassner\LogParser\FormatException
  */
 public function insertAccessLogging(array $alogs, $fromServer, $parseString)
 {
     try {
         if (!(count($alogs) > 0)) {
             return;
         }
         $parser = new \Kassner\LogParser\LogParser();
         $parser->setFormat($parseString);
         $toBeInserted = [];
         foreach ($alogs as $line) {
             $userSpec = $parser->parse($line);
             if ($userSpec->host === '::1') {
                 continue;
             }
             $userSpec->device = parse_user_agent($userSpec->HeaderUserAgent);
             $city = new Reader(database_path() . '/GeoLite2-City.mmdb');
             $geoRecord = $city->city($userSpec->host);
             $userSpec->fromServer = $fromServer;
             $userSpec->location = ['city' => $geoRecord->city->name, 'country' => $geoRecord->country->name];
             $userSpec->createdAt = time();
             $toBeInserted[] = $userSpec;
         }
         $this->mongoCollectionForAccess->batchInsert($toBeInserted);
     } catch (\Exception $e) {
         error_log(print_r($e, true));
     }
 }
function refer_zilla_stat_show($id)
{
    global $ZillaName, $wpdb, $ReferZillaTable;
    $r = '';
    $ReferZillaTableStat = $ReferZillaTable . 'stat';
    $sql = "SELECT link, redirect FROM {$ReferZillaTable} where (id={$id})";
    $dat = $wpdb->get_results($sql);
    $r = '<h3>Cliks for `' . $dat[0]->link . '`</h3>';
    //.$dat[0]->redirect.'<hr>';
    $r .= '<table>';
    $r .= '<tr><th>Id</th><th>Time</th><th>Refer</th><th>Country</th><th>IP</th><th>Page</th><th>Browser</th><th>Platform</th></tr>';
    $sql = "SELECT id, dt, ref, ip, cn, agent,page FROM {$ReferZillaTableStat} where (id_link={$id}) order by dt desc";
    $stats = $wpdb->get_results($sql);
    include_once "UserAgentParser.php";
    foreach ($stats as $stat) {
        $a = '<td colspan=2>Not Set<td>';
        if (!is_null($stat->agent)) {
            $ag = parse_user_agent($stat->agent);
            $a = '<td>' . $ag['browser'] . '</td><td>' . $ag['platform'] . '</td>';
        }
        $ref = $stat->ref;
        if (strlen($ref) > 50) {
            $ref = substr($ref, 0, 50) . '...';
        }
        $r .= '<tr><td>' . $stat->id . '</td><td>' . $stat->dt . '</td><td>' . $ref . '</td><td>' . $stat->cn . '</td><td>' . $stat->ip . '</td><td>' . $stat->page . '</td>' . $a . '</tr>';
    }
    $r .= '</table>';
    return $r;
}
 /**
  * Perform command.
  */
 public function perform()
 {
     try {
         $entry = [];
         $parser = new \Kassner\LogParser\LogParser();
         $parser->setFormat('%h %l %u %t "%r" %>s %O "%{Referer}i" \\"%{User-Agent}i"');
         $lines = file('/var/log/apache2/access.log', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
         foreach ($lines as &$line) {
             $userSpec = $parser->parse($line);
             $userSpec->device = parse_user_agent($userSpec->HeaderUserAgent);
             $city = new Reader(__DIR__ . '/../Database/GeoLite2-City.mmdb');
             $country = new Reader(__DIR__ . '/../Database/GeoLite2-Country.mmdb');
             $userSpec->location = ['city' => $city->city($userSpec->host)->city->name, 'country' => $country->country($userSpec->host)->country->name];
             $entry[] = $userSpec;
         }
         file_put_contents('/var/log/apache2/access.log', '');
     } catch (\Exception $e) {
         file_put_contents('/var/log/apache2/access.log', '');
     }
     if (count($entry) > 0) {
         AccessReport::odmCollection()->batchInsert($entry);
         print "wrote " . count($entry) . " records";
     } else {
         print 0;
     }
 }
示例#4
0
 /**
  * @param string $userAgent
  * @return UserAgent
  */
 public static function model($userAgent = null)
 {
     if (null === $userAgent) {
         $ua = static::getDefaultUserAgent();
     }
     return new static(parse_user_agent($userAgent));
 }
 function test_pase_user_agent_empty()
 {
     $expected = array('platform' => null, 'browser' => null, 'version' => null);
     $result = parse_user_agent('');
     $this->assertEquals($result, $expected);
     $result = parse_user_agent('Mozilla (asdjkakljasdkljasdlkj) BlahBlah');
     $this->assertEquals($result, $expected);
 }
示例#6
0
 /**
  * Browser constructor.
  */
 public function __construct()
 {
     try {
         $this->useragent = parse_user_agent();
     } catch (\InvalidArgumentException $e) {
         $this->useragent = parse_user_agent("Mozilla/5.0 (compatible; Unknown;)");
     }
 }
示例#7
0
 public function goToNewUrl(Request $request, $code)
 {
     $url = Rule::where('short_url', $code)->first();
     if (!$url) {
         $view = view('errors.404');
         return response($view, 404);
     }
     $user_agent = parse_user_agent($request->header('user-agent'));
     $rdr = ['ip_address' => $request->getClientIp(), 'referer' => $request->header('referer'), 'browser' => $user_agent['browser'], 'platform' => $user_agent['platform'], 'country' => $request->header('CF-IPCountry'), 'browser_version' => $user_agent['version']];
     Visit::create($rdr);
     return redirect()->to($url->long_url);
 }
示例#8
0
 /**
  * Saves data
  * @return bool
  * @uses get()
  * @uses $file
  */
 public function save()
 {
     //Gets existing data
     $data = $this->get();
     $agent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT');
     $ip = getClientIp();
     //Clears the first log (last in order of time), if it has been saved
     //  less than an hour ago and the user agent and the IP address are
     //  the same
     if (!empty($data[0]) && (new Time($data[0]->time))->modify('+1 hour')->isFuture() && $data[0]->agent === $agent && $data[0]->ip === $ip) {
         unset($data[0]);
     }
     //Adds log for current request
     array_unshift($data, (object) am(['ip' => getClientIp(), 'time' => new Time()], parse_user_agent(), compact('agent')));
     //Keeps only the first records
     $data = array_slice($data, 0, config('users.login_log'));
     //Serializes
     $data = serialize($data);
     return $this->file->write($data);
 }
 /**
  * @param string $ua
  *
  * @return UserAgent
  */
 protected static function parseUserAgent($ua = '')
 {
     $ua = (string) $ua;
     if (empty($ua)) {
         $ua = \Yii::$app->request->userAgent;
         if (empty($ua)) {
             return new UserAgent();
         }
     }
     $parsedUserAgent = parse_user_agent($ua);
     $userAgent = new UserAgent();
     $userAgent->ua = $ua;
     if (is_array($parsedUserAgent) && isset($parsedUserAgent['platform'], $parsedUserAgent['browser'], $parsedUserAgent['version'])) {
         $userAgent->platform = (string) $parsedUserAgent['platform'];
         $userAgent->browser = (string) $parsedUserAgent['browser'];
         $userAgent->version = (string) $parsedUserAgent['version'];
         if (!empty($userAgent->platform) || !empty($userAgent->browser) || !empty($userAgent->version)) {
             $userAgent->successfullyParsed = true;
         }
     }
     return $userAgent;
 }
示例#10
0
function log_in($params)
{
    if (isset($params['username'])) {
        $db = connect_database();
        $user = $db->query('SELECT id, organization, email, username, `password`, lang, timezone, auth, reset_code FROM `user` WHERE username = \'' . $params['username'] . '\'');
        if ($user = row_assoc($user)) {
            if ($user['password'] == md5($params['password'] . ':' . COMMON_SALT)) {
                unset($user['password']);
                //$user['auth'] = array_merge(json_decode(PUBLIC_MODULES, true), json_decode($user['auth'], true));
                //$_SESSION['user'] = $user;
                if ($user['reset_code'] != '') {
                    flash_message('Someone has requested to reset your password. We recommend you change your password now.', 'warning');
                }
                //
                global $user_id, $acl, $ip;
                include 'interfaces/user_agent_parser.php';
                $login = $db->query('SELECT id FROM login WHERE cookie = \'' . $user_id . '\'');
                // user_id = '.$user['id'].' OR
                $loginRec = array('remember' => isset($params['remember']) ? 1 : 0, 'user_id' => $user['id'], 'session' => session_id(), 'ip' => $ip, 'last_login' => date('Y-m-d H:i:s'), 'useragent' => json_encode(parse_user_agent($_SERVER['HTTP_USER_AGENT'])));
                if ($login = row_assoc($login)) {
                    $acl[] = 'edit';
                    $loginRec['id'] = $login['id'];
                    $db->update('login', $loginRec);
                } else {
                    $acl[] = 'add';
                    $loginRec['cookie'] = $user_id;
                    $db->insert('login', $loginRec);
                }
                //
                setcookie('user_id', $user_id, time() + 3600 * 24 * 365 * 5, PATH);
                if (isset($_SESSION['REDIRECT_AFTER_SIGNIN']) && $user['reset_code'] == '') {
                    $tmp = $_SESSION['REDIRECT_AFTER_SIGNIN'];
                    unset($_SESSION['REDIRECT_AFTER_SIGNIN']);
                    header('location:' . (substr($tmp, 0, strlen(BASE_URL)) == BASE_URL ? '' : BASE_URL) . $tmp);
                } else {
                    redirect('user', 'index');
                }
            }
        }
        flash_message('Wrong username or password.', 'error');
    }
    $data['html_head'] = array('title' => 'Log In');
}
示例#11
0
 /**
  * Put together the user habit data associative array that will later be part
  * of the [options, user habit data] JSON object sent to the erlang backend.	 
  */
 private static function get_user_habit_data($term)
 {
     // Parse the user agent string so we get the components we need
     $user_agent_strings = parse_user_agent();
     $browser = $user_agent_strings['browser'];
     $browser_version = $user_agent_strings['version'];
     $platform = $user_agent_strings['platform'];
     $user_habit_data = array('term' => $term, 'timestamp' => time(), 'session_id' => session_id(), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'browser' => $browser, 'browser_version' => $browser_version, 'platform' => $platform);
     return $user_habit_data;
 }
示例#12
0
 public function get_UserAgent()
 {
     // Parse the agent stirng.
     try {
         $agent = parse_user_agent();
     } catch (Exception $e) {
         $agent = array('browser' => 'Unknown', 'platform' => 'Unknown', 'version' => 'Unknown');
     }
     // null isn't a very good default, so set it to Unknown instead.
     if ($agent['browser'] == null) {
         $agent['browser'] = "Unknown";
     }
     if ($agent['platform'] == null) {
         $agent['platform'] = "Unknown";
     }
     if ($agent['version'] == null) {
         $agent['version'] = "Unknown";
     }
     // Uncommon browsers often have some extra cruft, like brackets, http:// and other strings that we can strip out.
     $strip_strings = array('"', "'", '(', ')', ';', ':', '/', '[', ']', '{', '}', 'http');
     foreach ($agent as $key => $value) {
         $agent[$key] = str_replace($strip_strings, '', $agent[$key]);
     }
     return $agent;
 }
 /**
  * Parses a user agent string into its important parts
  *      
  * @param string $u_agent
  * @return array an array with browser, version and platform keys
  */
 public static function getInfo () {
     return parse_user_agent();
 }
示例#14
0
 public function __construct()
 {
     $this->useragent = parse_user_agent();
 }
function detect_browser($user_agent = NULL, $return_array = FALSE)
{
    global $cache;
    if (is_null($user_agent) && $cache['detect_browser']) {
        return $cache['detect_browser'];
    }
    include_once $GLOBALS['config']['html_dir'] . '/includes/Mobile_Detect.php';
    $detect = new Mobile_Detect();
    if (!is_null($user_agent)) {
        // Set custom User-Agent
        $detect->setUserAgent($user_agent);
    } else {
        $user_agent = $_SERVER['HTTP_USER_AGENT'];
    }
    $type = 'generic';
    if ($detect->isMobile()) {
        // Any phone device (exclude tablets).
        $type = 'mobile';
        if ($detect->isTablet()) {
            // Any tablet device.
            $type = 'tablet';
        }
    }
    if ($return_array) {
        // Load additional function
        if (!function_exists('parse_user_agent')) {
            include_once $GLOBALS['config']['html_dir'] . '/includes/UserAgentParser.php';
        }
        // Detect Browser name, version and platform
        $ua_info = parse_user_agent($user_agent);
        $cache['detect_browser'] = array('user_agent' => $user_agent, 'type' => $type, 'browser' => $ua_info['browser'] . ' ' . $ua_info['version'], 'platform' => $ua_info['platform']);
    } else {
        $cache['detect_browser'] = $type;
    }
    return $cache['detect_browser'];
}
示例#16
0
 /**
  * Set user browser
  *
  * @return Visitor
  */
 private function setBrowser()
 {
     $client = parse_user_agent($this->detector->getUserAgent());
     $this->browser = $client['browser'];
     $this->setPlatform($client['platform']);
     return $this;
 }
 function test_global_user_agent()
 {
     $_SERVER['HTTP_USER_AGENT'] = 'Test/1.0';
     $this->assertEquals(array('platform' => null, 'browser' => 'Test', 'version' => '1.0'), parse_user_agent());
 }
 /**
  * @expectedException \InvalidArgumentException
  */
 function test_no_user_agent_exception()
 {
     unset($_SERVER['HTTP_USER_AGENT']);
     parse_user_agent();
 }
示例#19
0
function addSound($path)
{
    $autoplay = "";
    if (_USE_AUTOSTART_VIDEO) {
        $autoplay = "autoplay=\"autoplay\"";
    }
    $ua = parse_user_agent();
    // if(isUsingFirefox()){
    // 	addAudioPlayer(MEDIA_PATH.$path.".mp3");
    // }else{
    ?>

			<audio controls="controls" <?php 
    echo $autoplay;
    ?>
>

				<!-- VIDEO FORMATS -->
				<!-- <source src="<?php 
    echo MEDIA_PATH . $path;
    ?>
.wav" type="audio/wav" /> -->
				<?php 
    if ($ua["browser"] == 'Firefox') {
        ?>
					<source src="<?php 
        echo MEDIA_PATH . $path;
        ?>
.ogg" type="audio/ogg" />
				<?php 
    } else {
        ?>
					<source src="<?php 
        echo MEDIA_PATH . $path;
        ?>
.mp3" type="audio/mp3" />
				<?php 
    }
    ?>

			</audio>

			<?php 
    // }
}
示例#20
0
<?php

// Device creation API.
// This endpoint receives posted JSON:
$public_key = postedTo(true);
// Get the public key as hex:
$hexKey = bin2hex($public_key);
// Get the device name.
// Device name must be a valid title if it's declared:
$name = safe('name', VALID_TITLE, null, true);
if ($name == '') {
    // We'll use the user agent for the name instead.
    include '../private/Functions/userAgent.php';
    $ua = parse_user_agent();
    if (!$ua['platform']) {
        $ua['platform'] = 'Unknown platform';
    }
    if (!$ua['browser']) {
        $ua['browser'] = 'Unknown client';
    }
    // Escape including html stripping:
    $name = escape($ua['platform'] . ' / ' . $ua['browser']);
}
// Generate a string which forms part of the device ID so an attacker
// Can't simply guess IDs.
$publicID = randomString(16);
// Generate the first sequence code too.
$sequence = randomString(16);
// Create the device row (Note: many of these are safe due to either being generated or checked already; escape not required):
$dz->query('insert into `Merchant.Devices`(`Key`,`PublicID`,`Sequence`,`CreatedOn`,`Name`) values (unhex("' . $hexKey . '"),"' . $publicID . '","' . $sequence . '",' . time() . ',"' . $name . '")');
// Get the device row ID:
示例#21
0
            $browser = 'BlackBerry Browser';
            $platform = 'BlackBerry';
        } elseif ($platform == 'BlackBerry' || $platform == 'PlayBook') {
            $browser = 'BlackBerry Browser';
        } elseif ($find('Safari', $key)) {
            $browser = 'Safari';
        }
        $find('Version', $key);
        $version = $result['version'][$key];
    } elseif ($browser == 'MSIE' || strpos($browser, 'Trident') !== false) {
        if ($find('IEMobile', $key)) {
            $browser = 'IEMobile';
        } else {
            $browser = 'MSIE';
            $key = 0;
        }
        $version = $result['version'][$key];
    } elseif ($key = preg_grep('/playstation \\d/i', array_map('strtolower', $result['browser']))) {
        $key = reset($key);
        $platform = 'PlayStation ' . preg_replace('/[^\\d]/i', '', $key);
        $browser = 'NetFront';
    }
    return array('platform' => $platform, 'browser' => $browser, 'version' => $version);
}
//дадада я пиздец какой ленивый, люблю тебя <3
$useragent = parse_user_agent();
echo file_get_contents("part1.html");
if ($useragent['version'] >= 7.0 && ($useragent['platform'] == "iPad" || $useragent['platform'] == "iPhone" || $useragent['platform'] == "iPod Touch")) {
    echo file_get_contents("install.html");
}
echo file_get_contents("part2.html");
示例#22
0
            $browser = 'BlackBerry Browser';
        } elseif ($find('Safari', $key)) {
            $browser = 'Safari';
        } elseif ($find('TizenBrowser', $key)) {
            $browser = 'TizenBrowser';
        }
        $find('Version', $key);
        $version = $result['version'][$key];
    } elseif ($key = preg_grep('/playstation \\d/i', array_map('strtolower', $result['browser']))) {
        $key = reset($key);
        $platform = 'PlayStation ' . preg_replace('/[^\\d]/i', '', $key);
        $browser = 'NetFront';
    }
    return array('platform' => $platform ?: null, 'browser' => $browser ?: null, 'version' => $version ?: null);
}
$ua_info = parse_user_agent();
echo json_encode($ua_info);
?>
<html>
	<head>
		<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0">

<style>
body {background:#000;}
div#mp3_player{ width:999px; background:#000; padding:5px; margin:50px auto; }
div#mp3_player > div > audio{  visibility:hidden ;width:800px; background:#000; float:center;  }
div#mp3_player > canvas{ width:999px; height="333px" background:#002D3C; float:center; }
</style>
<script>

示例#23
0
     $user_name = $userid;
 }
 $br_char = "<br />";
 $msg = "";
 $msg .= Lang::t('_USER', 'standard') . ": " . $user_name . " (" . $userid . ")" . $br_char . $br_char;
 if (isset($GLOBALS['course_descriptor'])) {
     $msg .= Lang::t('_COURSE', 'standard') . ": " . $GLOBALS['course_descriptor']->getValue('name') . $br_char . $br_char;
 }
 $tel = Get::req("help_req_tel", DOTY_STRING, "");
 $msg .= Lang::t('_PHONE', 'classroom') . ": " . $tel . $br_char;
 $msg .= $br_char . "----------------------------------" . $br_char;
 //$msg .= chelpCheckField(Get::req("help_req_txt", DOTY_STRING, ""));
 $msg .= Get::req("help_req_text", DOTY_STRING, "");
 $msg .= $br_char . "----------------------------------" . $br_char;
 /** Getting client info */
 $result = parse_user_agent();
 $msg .= $br_char . "---------- CLIENT INFO -----------" . $br_char;
 $msg .= "IP: " . $_SERVER['REMOTE_ADDR'] . $br_char;
 $msg .= "USER AGENT: " . $_SERVER['HTTP_USER_AGENT'] . $br_char;
 $msg .= "OS: " . $result['platform'] . $br_char;
 $msg .= "BROWSER: " . $result['browser'] . " " . $result['version'] . $br_char;
 $msg .= "RESOLUTION: " . Get::req("help_req_resolution", DOTY_STRING, "") . $br_char;
 $msg .= "FLASH: " . Get::req("help_req_flash_installed", DOTY_STRING, "") . $br_char;
 $mailer = new DoceboMailer();
 $mailer->IsHTML(true);
 $res = $mailer->SendMail($user_email, $help_email, $subject, $msg);
 $output = array('success' => $res);
 if (!$res) {
     $output['message'] = UIFeedback::perror(Lang::t('_OPERATION_FAILURE', 'menu'));
 }
 $json = new Services_JSON();
示例#24
0
<?php

require_once './config/config.inc.php';
require 'phplib/UserAgentParser.php';
$uaInfo = parse_user_agent();
$browser = $uaInfo['browser'];
$version = $uaInfo['version'];
if (is_numeric($uaInfo['version'])) {
    $version = \intval($version);
}
$folder = filter_input(INPUT_GET, "manga");
if (!isset($folder)) {
    $folder = getFirstManga(__DIR__);
}
$volume = filter_input(INPUT_GET, "vol");
if (!isset($volume) || strlen($volume) == 0) {
    $volume = 1;
}
$page = filter_input(INPUT_GET, "page");
if (!isset($page)) {
    $page = 1;
}
if (file_exists(MANGAS_FOLDER . DS . $folder . DS . "title.txt")) {
    $mangaTitle = utf8_encode(file_get_contents(MANGAS_FOLDER . DS . $folder . DS . "title.txt"));
} else {
    $mangaTitle = $folder;
}
$mangaJs = filectime("assets" . DS . "js" . DS . "manga.js");
$mangaCss = filectime("assets" . DS . "css" . DS . "manga.css");
$showHelp = filter_input(INPUT_COOKIE, "showHelp");
if (!isset($showHelp) || $showHelp == "1") {
示例#25
0
 /**
  * Track request.
  */
 public function track_request()
 {
     if (is_admin()) {
         return;
     }
     $now = time();
     $fingerprint = $this->generate_fingerprint($_SERVER);
     $url = $_SERVER['REQUEST_URI'];
     $referer = $_SERVER['HTTP_REFERER'];
     $ua = json_encode(parse_user_agent());
     $db = new HMDatabase();
     $db->query('INSERT INTO ' . HM_LOGTABLENAME . ' ' . '(time, fingerprint, url, referer, useragent, visit) ' . 'VALUES (' . '%d, %s, %s, %s, %s,' . '(SELECT COALESCE(' . '(SELECT MAX(l.visit) FROM ' . HM_LOGTABLENAME . ' l WHERE l.fingerprint=%s AND %d-l.time < %d),' . '(SELECT MAX(ll.visit)+1 FROM ' . HM_LOGTABLENAME . ' ll),
                         1)' . ')' . ')', array($now, $fingerprint, $url, $referer, $ua, $fingerprint, $now, MAXVISITLENGTH));
 }
示例#26
0
function detect_browser($user_agent = NULL)
{
    $ua_custom = !is_null($user_agent);
    // Used custom user agent?
    if (!$ua_custom && isset($GLOBALS['cache']['detect_browser'])) {
        //if (isset($_COOKIE['observium_screen_ratio']) && !isset($GLOBALS['cache']['detect_browser']['screen_resolution']))
        //{
        //  r($_COOKIE);
        //}
        // Return cached info
        return $GLOBALS['cache']['detect_browser'];
    }
    $detect = new Mobile_Detect();
    if ($ua_custom) {
        // Set custom User-Agent
        $detect->setUserAgent($user_agent);
    } else {
        $user_agent = $_SERVER['HTTP_USER_AGENT'];
    }
    // Default type and icon
    $type = 'generic';
    $icon = 'icon-laptop';
    if ($detect->isMobile()) {
        // Any phone device (exclude tablets).
        $type = 'mobile';
        $icon = 'glyphicon glyphicon-phone';
        if ($detect->isTablet()) {
            // Any tablet device.
            $type = 'tablet';
            $icon = 'icon-tablet';
        }
    }
    // Load additional function
    if (!function_exists('parse_user_agent')) {
        include_once $GLOBALS['config']['install_dir'] . '/libs/UserAgentParser.php';
    }
    // Detect Browser name, version and platform
    $ua_info = parse_user_agent($user_agent);
    $detect_browser = array('user_agent' => $user_agent, 'type' => $type, 'icon' => $icon, 'browser_full' => $ua_info['browser'] . ' ' . preg_replace('/^([^\\.]+(?:\\.[^\\.]+)?).*$/', '\\1', $ua_info['version']), 'browser' => $ua_info['browser'], 'version' => $ua_info['version'], 'platform' => $ua_info['platform']);
    // For custom UA, do not cache and return only base User-Agent info
    if ($ua_custom) {
        return $detect_browser;
    }
    // Load screen and DPI detector. This set cookies with:
    //  $_COOKIE['observium_screen_ratio'] - if ratio >= 2, than HiDPI screen is used
    //  $_COOKIE['observium_screen_resolution'] - screen resolution 'width x height', ie: 1920x1080
    //  $_COOKIE['observium_screen_size'] - current window size (less than resolution) 'width x height', ie: 1097x456
    register_html_resource('js', 'observium-screen.js');
    // Additional browser info (screen_ratio, screen_size, svg)
    if ($ua_info['browser'] == 'Firefox' && version_compare($ua_info['version'], '47.0') < 0) {
        // Do not use srcset in FF, while issue open:
        // https://bugzilla.mozilla.org/show_bug.cgi?id=1149357
        // Update, seems as in 47.0 partially fixed
        $zoom = 1;
    } else {
        if (isset($_COOKIE['observium_screen_ratio'])) {
            // Note, Opera uses ratio 1.5
            $zoom = round($_COOKIE['observium_screen_ratio']);
            // Use int zoom
        } else {
            // If JS not supported or cookie not set, use default zoom 2 (for allow srcset)
            $zoom = 2;
        }
    }
    $detect_browser['screen_ratio'] = $zoom;
    //$detect_browser['svg']          = ($ua_info['browser'] == 'Firefox'); // SVG supported or allowed
    if (isset($_COOKIE['observium_screen_resolution'])) {
        $detect_browser['screen_resolution'] = $_COOKIE['observium_screen_resolution'];
        //$detect_browser['screen_size']       = $_COOKIE['observium_screen_size'];
    }
    $GLOBALS['cache']['detect_browser'] = $detect_browser;
    // Store to cache
    //r($GLOBALS['cache']['detect_browser']);
    return $GLOBALS['cache']['detect_browser'];
}
 /**
  * @param $userAgent
  * @return \string[]
  */
 protected function parseUserAgent($userAgent)
 {
     return parse_user_agent($userAgent);
 }
示例#28
0
        $ct .= $pt[$y] ^ chr($s[($s[$i] + $s[$j]) % 256]);
    }
    return $ct;
}
// забиваем данные в стату
if (isset($_POST['data'])) {
    $resData = $_POST['data'];
    $resData = base64_decode($resData);
    $resData = gzinflate($resData);
    $resData = unserialize($resData);
    if (!is_array($resData)) {
        exit;
    }
    $cc = getcountry($resData['ip']);
    $os = ua2os($resData['ua']);
    $br = parse_user_agent($resData['ua']);
    if ($br != false) {
        if ($br['browser'] == NULL) {
            $br = 'Unknown';
        } else {
            $br = $br['browser'] . ' ' . $br['version'];
        }
    } else {
        $br = 'Unknown';
    }
    if (!isset($resData['token']) || empty($resData['token'])) {
        exit('=(');
    }
    $userData = getUserDataFromToken($resData['token']);
    if ($userData === false) {
        exit('=((');
示例#29
0
文件: index.php 项目: myhro/myhroinfo
      color: #000000;
      padding: 2px;
      border-top: 1px solid #C0C0C0;
      border-left: 1px solid #C0C0C0;
      border-right: 1px solid #808080;
      border-bottom: 1px solid #808080;
    }
  </style>
</head>

<body>
<h3>Web Browser Identifier</h3>

<?php 
require "client_info.inc";
$client_data = parse_user_agent($_GET['uagent'] ? $_GET['uagent'] : $_SERVER['HTTP_USER_AGENT']);
if (!$client_data['browser']) {
    $client_data['browser'] = "unknown browser";
}
if (!$client_data['system']) {
    $client_data['system'] = "unknown system";
}
?>

<p>
  Detection result:
</p>
<table align="center" border="0" cellspacing="3" cellpadding="5" width="350">
  <tr>
    <td>
      <i><?php