Page 1 of 1

Doing math with the date function

Posted: Mon Nov 12, 2007 9:26 am
by eon201
Hi im kinda stuck with the date function.

What im trying to do is to get my code to compare two date times (a and b). And if a is >7 minutes in time difference then continue with the if statement if else ignore.
But im stuc and dont know how to do this. Any help will be greatly appreciatted.

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;
		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
						
						$mylogtime = $log_time;
												
						$find = 'booked/excursions/index.php';
						
						if (strpos($request, $find) == true) //SURELY IN HERE I SHOULD USE $array[$key - 1]?? comparing $mylogtime and $log_time ??
						{
						print_r("$request  ");
						$uniquepages[] = $log_client;
						$n++;
						echo "$mylogtime<br/>";
						}
						
						

				
				
				else
				{
				}

		}		
				echo "<br/>Page views for '$find' = $n<br/><br/>";
				echo "Unique page views =". count(array_unique($uniquepages));
				fclose($fp);			

?>
Thanks in advance. EON201