%PDF- %PDF-
Direktori : /var/www_old/ |
Current File : //var/www_old/dboxjson.php__b81eaf3 |
<?php include "dibi.min.php"; dibi::connect(array( 'driver' => 'postgre', 'string' => 'host=localhost port=5432 dbname=httplog user=httplog password=blade666', 'persistent' => TRUE, ));; $data = file_get_contents("php://input"); $fname = tempnam("/tmp", "dboxjson"); file_put_contents($fname, $data); unset($data); $f = gzopen($fname, "r"); while(!gzeof($f)) { $data = gzgets($f); if(trim($data) == "") continue; $obj = json_decode($data); $resp = array( 'vhost' => $_GET['branch'], 'timestamp' => strtotime($obj->{'@timestamp'}), 'version' => $obj->{'@version'}, 'host' => $obj->sHost, 'address' => $obj->sIpAddress, 'bytes' => $obj->bytes, 'cookie' => $obj->cookie, 'set_cookie' => $obj->{'set-cookie'}, 'duration' => $obj->duration, 'method' => $obj->method, 'referer' => $obj->referer, 'request' => $obj->request, 'ssl_protocol' => $obj->ssl_protocol, 'ssl_cipher' => $obj->ssl_cipher, 'status' => $obj->status, 'useragent' => $obj->useragent ); dibi::query("insert into [devbox]", $resp); dibi::test("insert into [httplog]", $resp); } gzclose($f); unlink($fname); ?>