<?php
sleep(2);
function addPath($s) {
	return '../../log/'.$s;
}
require('../../functions.php');
$ip = substr($_SERVER['REMOTE_ADDR'], 0, -2).'00';
loadConfig();
unlock_all_files();
$data = array();
$logfiles = array('../../log.txt');
$logfiles = array_merge($logfiles,array_map('addPath',array_slice(scandir('../../log'),2)));
$found = false;
$i = 0;
foreach($logfiles AS $file) {
	foreach(file($file) AS $line) {
		$line = explode(', ',$line);
		if($line[1]!=$ip) {
			$data[$file][] = implode(', ',$line);
		}
		else $i++;
	}
}
foreach($data AS $key=>$value) {
	file_put_contents($key,'');
	file_put_contents($key,implode('',$value));
}
echo $i;
?>