Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv
Posted: Sun Jul 04, 2004 11:25 pm
Edit:
heres my fixed code:
this is the whosonline.php script. Why is it giving me this error? How can I fix it? Also, how would I get the id's into the table, would I need to include some code in my login page? If so, what would I need to write?
thanks
heres my fixed code:
Code: Select all
<?
require 'db_connect.php';
if (strstr($_SERVER['REMOTE_ADDR'], ', ')) {
$ips = explode(', ', $_SERVER['REMOTE_ADDR']);
$uvisitor = $ips[0];
} else {
$uvisitor = $_SERVER['REMOTE_ADDR'];
}
$exptime=$utime-600; // (in seconds)
@mysql_query("delete from online where timevisit<$exptime");
$uexists=@mysql_num_rows(@mysql_query("select id from online where visitor='$uvisitor'"));
if ($uexists>0){
@mysql_query("update online set timevisit='$utime' where visitor='$uvisitor'");
} else {
@mysql_query("insert into online (visitor,timevisit) values ('$uvisitor','$utime')");
}
$rs=@mysql_query("select * from online");
echo "<style><!--\n";
echo "body {font-family:verdana;font-size:10pt}\n";
echo "td {font-family:verdana;font-size:10pt}\n";
echo "--></style>\n";
echo "<div align=center><table><tr bgcolor=#CCCCCC><td><b>Visitor
IP/Host<td><b>Last visit</tr>";
while ($ro=@mysql_fetch_array($rs)){
echo "<tr><td>".$ro[visitor]."<td>".date('j M Y - H:i',$ro[timevisit])."</tr>";
}
echo "</table></div>";
$jmlonline=@mysql_num_rows(@mysql_query("select id from online"));
echo "<div align=center><b>There are $jmlonline user online</b></div>";
?>thanks