Location: PHPKode > scripts > Image Hotlink Log and Control > hotlinklogflush.php
<?php

// Hotlink Log and Image Watermarking Script
// Copyright (C) 2005  SillyJokes.co.uk


require 'hotlinklogconfig.php';
require 'hotlinklogfuncs.php';

// Remove old log entries from hotlink log file

set_time_limit(120);


$f = fopen(LOGFILE,'r');
$fnew = fopen(LOGFILE.'new','w');
$files = array();
$referrers = array();
while (!feof($f))
{
	$buf = fgets($f);		// defaults to reading a whole line at a time, no matter what it's girth be
	$guff = MungLogLine($buf);
	if ($guff===FALSE)
	{
		continue;
	}
	extract($guff);	// makes $filename, $time, $action, $referrer
	
	$now = time();
	if(($now-$time)>FLUSHTIME)
	{
		continue;
	}
	
	fwrite($fnew,$buf);
}

fclose($fnew);
fclose($f);

//unlink(LOGFILE);
copy(LOGFILE.'new',LOGFILE);

echo 'flushed';

?>
Return current item: Image Hotlink Log and Control