<?php
header('Content-Type: text/plain');
header('Access-Control-Allow-Origin: *');

ini_set('display_errors',1);
error_reporting(E_ALL);

require_once('functions.php');

$config = loadConfig();
unlock_all_files();

if($config[0]=="active") {
$location = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.substr($_SERVER['REMOTE_ADDR'], 0, -2).'00'));
$line = array($_POST['site'],substr($_SERVER['REMOTE_ADDR'], 0, -2).'00',$_POST['screen_width'],$_POST['screen_orientation'],str_replace(', ', '_ ', $_SERVER ['HTTP_USER_AGENT']),substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'],',')),$_POST['platform'],$_POST['plugins'],$_POST['time_on_site'],date("d.m.Y H:i",time()),$_SERVER['HTTP_REFERER'],$_POST['title'],$_POST['description'],$_POST['actions'],$location['geoplugin_countryName'],$location['geoplugin_regionName']);
file_put_contents(($_POST['datafor']=='main' ? 'log.txt' : 'log/'.$_POST['datafor']),implode(', ',$line)."\r\n",FILE_APPEND);
}
?>