打造计数器DIY三步曲(中)
打造计数器DIY三步曲(中),打造计数器DIY三步曲(中)
我以假设您有多个镜像站为例,首先在数据表中插入几个新的数据num、visited,这在你的镜像站上将用的着,只要将上篇中的count1.php改一下即可.
先建立一个文件夹count,里面放上您要用的文件count2.php,count3.php……,举个例子,如count2的源码,将count1.php改成:
<?
$linkptr=mysql_pconnect("localhost","yourname","password");
mysql_select_db("yourname",$linkptr);
mysql_query("update counter
set visited=visited+1 where num=2",$linkptr);
$result=mysql_query("select visited
from counter where num=2",$linkptr);
list($counter)=mysql_fetch_row($result);
$counter=sprintf("%05d",$counter);
for($i=0;$i<5;$i++){
$tmpstr="<img src="http://img.jcwcn.com/attachment/portal/jcwcj/2005-12/10/05121010222418724.GIF" border=0 ";
echo $tmpstr;
}
?
注意:"<img src="http://img.jcwcn.com/attachment/portal"