im using this script to know who is online, but some ip_address filds on the table are Empty, i dont know why. Please help me.
Here is the code i use to get the info of the user to the table.
if (getenv(HTTP_CLIENT_IP)){
$ip=getenv(HTTP_CLIENT_IP);
}
else {
$ip=getenv(REMOTE_ADDR);
}
$query="SELECT user FROM mundo_online WHERE user='$user' AND ip_address='$ip'";
$online->query($query);
$time=time();
IF($online->num_rows()==0)
{
if(chop($ip)!='' OR empty($ip))
{
$query = "INSERT INTO mundo_online (user, time, ip_address) VALUES ('$user','$time','$ip')";
$online->query($query);
}
}
ELSE
{
if(chop($ip)!='' OR empty($ip))
{
$query = "UPDATE mundo_online SET time='$time' WHERE user='$user' AND ip_address='$ip' ";
$online->query($query);
}
}
With this code i get a table like this.
poteiro 11:29:07 200.10.225.78
poteiro 11:29:07
el trokil 11:29:37 200.10.225.78
cenarava 11:30:49 200.27.107.36 4
sengir 11:32:41
sengir 11:33:39 200.27.107.36 6
If you can see some users dont get their IP on the table sometimes. I really dont know why.
Please help me.