刚做的一个网页计数器 大家参考一下

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

<?

$counterFile="counter.txt";

$fp=fopen($counterFile,"r+");

$num=fgets($fp,10);

if(!$count){

$second=3600;

setcookie("count",1,time()+$second);

$num+=1;

rewind($fp);

flock($fp,2);

fwrite($fp,$num);

}

fclose($fp);

function echoimg($n){

$l=strlen($n);

for($i=0;$i<$l;$i++){

$img=substr($n,$i,1);

echo "<img src=\"".$img.".gif\">";

}

}

?>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>记数器</title>

</head>

<body>

<div id="Layer1" style="position:absolute; left:158px; top:43px; width:191px; height:60px; z-index:1">你是本页面第<? echoimg($num);?>个访客</div>

</body>

</html>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航