problems with strtotime function
Posted: Tue Nov 13, 2007 4:01 am
Im having trouble getting the the correct answer when I take one strored time away from another. Can anyone see why??
Here is the code:
Here is the output of the file:
/booked/excursions/index.php 1194941763 - This is the whole number
1194941763 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194953776 - This is the whole number
1194953776 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194954604 - This is the whole number
1194954604 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194954612 - This is the whole number
1194954612 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194955060 - This is the whole number
1194955060 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194956424 - This is the whole number
1194956424 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194957320 - This is the whole number
1194957320 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194957433 - This is the whole number
1194957433 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194957902 - This is the whole number
1194957902 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194958178 - This is the whole number
1194958178 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194958543 - This is the whole number
1194958543 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194959837 - This is the whole number
1194959837 - This should not be the whole number but the sum.
Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in D:\home\Default\planetcruise-svr.co.uk\htdocs\pcm\logreader4.php on line 37
Page views for 'booked/excursions/index.php' = 12
Unique page views for 'booked/excursions/index.php' = 12
I just cant see why the stored numbers dont do the sum. Can anyone else??
Thanks in advance. EOn201
Here is the code:
Code: Select all
<?php
$filename = 'logs/'. 'ex'. date('ymd'). '.log'; // Filename Checker
$fp = fopen($filename, "r"); //Open the server log
$content = fread($fp, filesize($filename)); // Read the server log
$content = explode("\n", $content); // explode into array
//$content = array_reverse($content ); // reverse the array
$n =0;
$n2 =0;
foreach ($content as $key=>$value)
{
$bits = explode(" ", $value);
@$request = $bits[5]; // Get cs uri stem
@$log_client = $bits[9]; // Get client ip
@$log_time = $bits[1]; // Get client time
$log_time = strtotime($log_time);
$mylogtime = $log_time - $log_time[$key - 1];
$find = 'booked/excursions/index.php';
if (strpos($request, $find) == true)
{
print_r("$request ");
$n++;
echo "$log_time - This is the whole number<br/>";
echo "$mylogtime - This should not be the whole number but the sum.<br/><br/>";
if (($mylogtime) > (420)){
$n2++;
}
}
else
{
}
}
echo "<br/>Page views for '$find' = $n<br/><br/>";
echo "<br/>Unique page views for '$find' = $n2<br/><br/>";
fclose($fp);
?>/booked/excursions/index.php 1194941763 - This is the whole number
1194941763 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194953776 - This is the whole number
1194953776 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194954604 - This is the whole number
1194954604 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194954612 - This is the whole number
1194954612 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194955060 - This is the whole number
1194955060 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194956424 - This is the whole number
1194956424 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194957320 - This is the whole number
1194957320 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194957433 - This is the whole number
1194957433 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194957902 - This is the whole number
1194957902 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194958178 - This is the whole number
1194958178 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194958543 - This is the whole number
1194958543 - This should not be the whole number but the sum.
/booked/excursions/index.php 1194959837 - This is the whole number
1194959837 - This should not be the whole number but the sum.
Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in D:\home\Default\planetcruise-svr.co.uk\htdocs\pcm\logreader4.php on line 37
Page views for 'booked/excursions/index.php' = 12
Unique page views for 'booked/excursions/index.php' = 12
I just cant see why the stored numbers dont do the sum. Can anyone else??
Thanks in advance. EOn201