%PDF- %PDF-
| Direktori : /var/www_old/ |
| Current File : //var/www_old/opscr.php__b81eaf3 |
<?php
if (!isset($_SERVER['PHP_AUTH_USER']))
{
header('WWW-Authenticate: Basic realm="mrazitko OpCacheInfo"');
header('HTTP/1.0 401 Unauthorized');
echo 'UNAUTHORIZED!!!';
exit;
}
else
{
if($_SERVER['PHP_AUTH_USER'] != "waritko" && $_SERVER['PHP_AUTH_PW'] != "Pojka8uj")
{
header('WWW-Authenticate: Basic realm="mrazitko OpCacheInfo"');
header('HTTP/1.0 401 Unauthorized');
echo 'UNAUTHORIZED!!!';
exit;
}
}
ob_start();
function size_for_humans($bytes) {
if ($bytes > 1048576) {
return sprintf("%.2f MB", $bytes/1048576);
} else if ($bytes > 1024) {
return sprintf("%.2f kB", $bytes/1024);
} else return sprintf("%d bytes", $bytes);
}
$data = opcache_get_status();
$scr = array();
foreach($data['scripts'] as $s)
{
$d = new stdClass();
$d->script = $s['full_path'];
$d->hits = $s['hits'];
$d->memory = $s['memory_consumption'];
$d->lastHit = $s['last_used'];
$d->timestamp = $s['timestamp'];
$scr[] = $d;
}
?>
<html>
<head>
<meta charset="utf-8">
<title>OpCache script usage</title>
<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/themes/start/jquery-ui.css">
<link rel="stylesheet" href="//cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript"
src="//cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var dtopts = {
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": true,
"pageLength": 25,
"oLanguage": {
"sLengthMenu": "Zobraz _MENU_ záznamů na stránku",
"sZeroRecords": "Omlouváme se, ale nic nebylo nalezeno",
"sInfo": "Zobrazuji _START_ až _END_ z _TOTAL_ záznamů",
"sInfoEmpty": "Zobrazuji 0 až 0 z 0 záznamů",
"sInfoFiltered": "(Filtrováno z _MAX_ celkových záznamů)"
},
"aaSorting": [[ 4, "desc" ]]
};
$('#maintbl').dataTable(dtopts);
});
</script>
</head>
<body>
<table style="max-width: 1850px;" border="1" id="maintbl">
<thead>
<tr>
<th>Script</th>
<th>Timestamp</th>
<th>Last hit</th>
<th>Memory usage</th>
<th>Hits</th>
</tr>
</thead>
<tbody>
<?php
foreach($scr as $s)
{
?>
<tr>
<td><?php echo $s->script; ?></td>
<td><?php echo date("Y-m-d H:i:s", $s->timestamp); ?></td>
<td><?php echo $s->lastHit; ?></td>
<td data-order="<?php echo sprintf("%09d", $s->memory); ?>"><?php echo size_for_humans($s->memory); ?></td>
<td data-order="<?php echo sprintf("%09d", $s->hits); ?>"><?php echo number_format($s->hits, 0, '.', ' '); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</body>
</html>
<?php
$ret = ob_get_clean();
header("X-Original-Content-Lenght: ".strlen($ret));
// Gzip/Deflate/Bzip2 compression
if(stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "bzip2"))
{
$ret = bzcompress($ret, 9);
header("Content-Encoding: bzip2");
}
elseif(stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip"))
{
$ret = gzencode($ret, 9);
header("Content-Encoding: gzip");
}
elseif (stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "deflate"))
{
$ret = gzdeflate($ret, 9);
header("Content-Encoding: deflate");
}
header("Content-length: ".strlen($ret));
echo $ret;