<?php
header('Content-Type: application/vnd.ms-excel');
$ip = substr($_SERVER['REMOTE_ADDR'],0,-2).'00';
chmod('tmp_data/'.$ip.'.xlsx', 0700);
chmod('tmp_data/'.$ip.'.key.txt', 0700);
$key = file_get_contents('tmp_data/'.$ip.'.key.txt');
unlink('tmp_data/'.$ip.'.xlsx');
unlink('tmp_data/'.$ip.'.key.txt');
if($_GET['k']==$key) {
	echo 'Site	Ip	Screen width	Screen orientation	User Agent	 	 	 	Language	Platform	Plugins	Time on Site	Time	Referer	Title	Actions	Country Name	Region Name
'.file_get_contents('tmp_data/'.$ip.'.xlsx');
	unlink('tmp_data/'.$ip.'.xlsx');
	unlink('tmp_data/'.$ip.'.key.txt');
}
else echo 'Access failed because of wrong key.';
?>