outlet
7-17-05, 05:45 AM
I was looking at your bandwidth tips tutorial, and you suggested using this:
<?php
$total_size = 0;
$key = 0;
$units = array('Bytes', 'KB', 'MB', 'GB');
$file = file("/www/s/sdat/logs/access_log");
foreach ($file as $line) {
preg_match('/*\"*\"\ *\ (*).*/',$line,$matches);
if($matches;}// echo $matches[1].'<br />';}
}
while ($total_size >= 1024) {
$total_size = round($total_size/1024,2);
$key++;
}
echo $total_size.' '.$units;
?>
I got an error at first, until I removed the if($matches;}// echo $matches[1].'<br />';} line. but now, I get this: 0 Array as a result.
Anybody know how to fix it, or have a better php script for daily bandwidth usage?
<?php
$total_size = 0;
$key = 0;
$units = array('Bytes', 'KB', 'MB', 'GB');
$file = file("/www/s/sdat/logs/access_log");
foreach ($file as $line) {
preg_match('/*\"*\"\ *\ (*).*/',$line,$matches);
if($matches;}// echo $matches[1].'<br />';}
}
while ($total_size >= 1024) {
$total_size = round($total_size/1024,2);
$key++;
}
echo $total_size.' '.$units;
?>
I got an error at first, until I removed the if($matches;}// echo $matches[1].'<br />';} line. but now, I get this: 0 Array as a result.
Anybody know how to fix it, or have a better php script for daily bandwidth usage?