如何实现不同IP地址的浏览次数统计
<br /><?php<br />// 访客计数器函数<br />function counter() {<br /> !empty($_GET['weburl']) || die('weburl不能为空');<br /> $weburl = $_GET['weburl'];<br /><br /> $file = '/usr/local/apache/htdocs/MyTests/counter.txt';<br /> if (! file_exists($file)) {<br /> $num = 1;<br /> $cf = fopen($file, 'w');<br /> fwrite($cf, $weburl.' '.$num);<br /> fclose($cf);<br /> } else {<br /> $cf = fopen($file, 'rw');<br /> $num = fgets($cf);<br /> $num = substr($num, 15);<br /> fclose($cf);<br /><br /> ++$num;<br /> $cf = fopen($file, 'w');<br /> fwrite($cf, $num);<br /> fclose($cf);<br /> }<br />}<br /><br />?><br /><html><br /> <head><br /> <title>访客计数器</title><br /> </head><br /> <body><br /> <center><br /> <h1>欢迎访问</h1><br /><br /> <form action="counter()" name="url-form" method="get"><br /> <div><br /> <input type="text" name="weburl" size="15" /><br /> <br /> <input type="submit" name="Submit" value="提交" /><br /> </div><br /> </form><br /> <hr /><br /> <font size="7" color="red"><br /> 您是第<?php //echo counter() ?>位访客<br /> </font><br /> </center><br /> </body><br /></html><br /><br />