Hi all,
I currently use a PHP script to log the IP of a client. The limitation is if the client is using a VPN or Proxy. I have tried using X-Forwarded-For header with no success. I simply cannot get the IP to log at all. I was wondering if anyone could help me out. Here is my current script -
[php]<?php
date_default_timezone_set(‘Australia/Sydney’);
$iplogfile = ‘log.txt’;
$ipaddress = $_SERVER[‘REMOTE_ADDR’];
$file = file_get_contents($iplogfile);
if ( ! preg_match("/$ipaddress/", $file )) {
$webpage = $_SERVER[‘SCRIPT_NAME’];
$timestamp = date(‘d/m/Y H:i:s’);
$browser = $_SERVER[‘HTTP_USER_AGENT’];
$fp = fopen($iplogfile, ‘a+’);
fwrite($fp, ‘[’.$timestamp.’]: ‘.$ipaddress.’ '.$browser. “\r\n”);
fclose($fp);
}
?>
[/php]