Ignore:
Timestamp:
06/10/12 14:38:39 (13 years ago)
Author:
tbretz
Message:
Added Browscap.php to logging.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/www/smartfact/index.php

    r14121 r14141  
    6464if (isset($_GET['load']))
    6565{
     66    require_once('log/Browscap.php');
     67
    6668    $d = date("Y/m");
    6769
    6870    $path = "log/".$d;
    6971
     72    if (!file_exists("log/cache"))
     73        mkdir("log/cache", 0777, true);
     74
    7075    if (!file_exists($path))
    7176        mkdir($path, 0777, true);
    7277
    73     $addr = isset($_SERVER['REMOTE_ADDR'])   ? $_SERVER['REMOTE_ADDR']   : "-";
    74     $user = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : "-";
     78    $addr = isset($_SERVER['REMOTE_ADDR'])     ? $_SERVER['REMOTE_ADDR']     : "";
     79    $user = isset($_SERVER['PHP_AUTH_USER'])   ? $_SERVER['PHP_AUTH_USER']   : "";
    7580    $dns  = gethostbyaddr($addr);
    7681
     82    $bcap = new phpbrowscap\Browscap('log/cache');
     83    $info = $bcap->getBrowser();
     84
    7785    $file = fopen($path."/smartfact.log", "a");
    78     fwrite($file, date("Y/m/d H:i:s ").$addr." ".$dns." ".$user."\n");
     86    fwrite($file,
     87           date("Y-m-d H:i:s\t").$addr.
     88           "\t".$dns.
     89           "\t".$user.
     90           "\t".$info->Platform.
     91           "\t".$info->Browser.
     92           "\t".$info->Version.
     93           "\t".$info->isMobileDevice."\n");
    7994    fclose($file);
    8095
Note: See TracChangeset for help on using the changeset viewer.