$fp = fopen("counter.txt","r+");
$counter = fgets($fp,80);
$counter = doubleval($counter) + 1;
fseek ($fp,0);
fputs($fp,$counter);
fclose($fp);
/*
如果要把这个统计器做成图片的,可以加入下面代码,并且在images目录下做0,9命名的图片就ok了。
*/
$number = strlen("$counter");
for($i = 0;$i
$gra_counter = substr($counter,$i,1);
$image = $image."
";
}
if ($http_server_vars["http_x_forwarded_for"])
{
$ip = $http_server_vars["http_x_forwarded_for"];
}
elseif ($http_server_vars["http_client_ip"])
{
$ip = $http_server_vars["http_client_ip"];
}
elseif ($http_server_vars["remote_addr"])
{
$ip = $http_server_vars["remote_addr"];
}
elseif (getenv("http_x_forwarded_for"))
{
$ip = getenv("http_x_forwarded_for");
}
elseif (getenv("http_client_ip"))
{
$ip = getenv("http_client_ip");
}
elseif (getenv("remote_addr"))
{
$ip = getenv("remote_addr");
}
else
{
$ip = "unknown";
}