people maybe this next my question sounds like a basic question but i'am realy stuck with it:
here is my script:
==========================================
function f_getip()
{
$ip="unknown";
if (getenv(HTTP_X_FORWARDED_FOR))
{
$ip = getenv(HTTP_X_FORWARDED_FOR);
}else {
$ip = getenv(REMOTE_ADDR);
}
return $ip;
}
$ip = f_getip();
/params in/
$filename = "03.03.83";
$users_online_lib = "uo/";
$t_limit = 0;
/**/
$t_out = 60*$t_limit;
$f_name = md5($filename).".txt";
$f_update = @file($users_online_lib.$f_name);
$uo_w = array();
$uo_r = array();
$ip_found=0;
$users_total=0;
if(strlen($f_update)>0)
{
$uo_r = unserialize($f_update[0]);
while(list($key,$val)=each($uo_r))
{
echo "<br>key".$key;
$t_update = time() - $val['time'];
if ($t_update < $t_out and $key != $ip)
{
$uo_w[$key]['time']=$val['time'];
$uo_w[$key]['auth']=$val['auth'];
}
if ($t_update < $t_out and $key == $ip)
{
$uo_w[$key]['time']=time();
$uo_w[$key]['auth']=$val['auth'];
$ip_found=1;
}
}
}
if ($ip_found==0)
{
if(session_id())$sessionauth = $_SESSION['loggedin'];else $sessionauth=0;
$uo_w[$ip]['time']=time();
$uo_w[$ip]['auth']=$sessionauth;
}
echo "<br>".count($uo_w);
$uo_w=serialize($uo_w);
$f = fopen("$users_online_lib$f_name","w+");
fwrite($f,$uo_w,strlen($uo_w));
fclose($f);
==========================================
my problem is:
in my LAN 3 pc, on my pc apache 2
when i run this script from my pc then into txt file is added line with ip addr 127.0.1.1
when i run this script from second pc (with ip 192.168.1.4) then into txt file is added line with ip addr 192.168.1.4
when i run this script from third pc (with ip 192.168.1.5) then into txt file is added line with ip addr 192.168.1.4
i cant understand why when i run this script from third pc with ip 192.168.1.5 into txt file is added line with ip addr 192.168.1.4
thanks people