<?php
/***********************************************************
 * Sigma Informatics
 * @author Sigma Informatics http://www.sinf.gr
 * @copyright 2016 Sigma Informatics
 * created with: "Sigma Informatics Site Builder v. 3.50.3"
 * date: 1/6/2016
 * index.php
************************************************************/

require_once('./../firewall/firewall.php');

/* Policies
Use the OS if possible for IP detection
Checks must be spaced 10 minutes apart to help reduce server load
In the case of an error while accessing CheckIP, the client should not send an update */

   mb_internal_encoding("UTF-8");
   date_default_timezone_set('Europe/Athens');

function logline($data)
 {
       $logFile = 'log';  //'dyn-'.date(Ymd,time()).'.log';
       $handle = @fopen($logFile, "a+");
       @fwrite($handle, $data);
       @fclose($handle);
}

function getUser()
{
       $headers = getallheaders();

       $userAgent = (empty($headers['User-Agent'])) ? '' : $headers['User-Agent'];

       $user = (empty($headers['X-User'])) ? '' : $headers['X-User'];

       logline( date("d/m/Y H:i:s",time()) . "--" . $userAgent . "--" . $user . " " . $_SERVER['REMOTE_ADDR'] ."\r\n" );
}

//getUser();

die($_SERVER['REMOTE_ADDR']);


?>
