Home >Backend Development >PHP Tutorial >Geiger-Miller Counter Three Steps to DIY Counter (Part 2)
This article will introduce how to put your own counter on your own mirror site.
I will assume that you have multiple mirror sites as an example. First, insert several new data num and visited in the data table. This will be used on your mirror site. Just change count1.php in the previous article. Just click.
First create a folder count, and put the files you want to use count2.php, count3.php..., for example, take the source code of count2, change count1.php to:
$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="";
echo $tmpstr;
}
?>
Note: The complete path must be placed in " After completing this step, we create a folder show and put the corresponding files show2.php,
show3.php..., taking show2.php as an example, the source code is written as:
document.write("< a href=http://cnfree.oso.com.cn target=_blank title= China Free Resource Information Alliance > include "../count/count2.php" ?>") ;
Note: include "../count/count2.php" ?> Don’t forget to put two dots before count, this is the complete path!
Finally, place it at the appropriate location on your mirror site Code:
http://cnfree.oso.com.cn I am at OSO You can replace the space on it with your own!
Okay, everything is OK! Check to see if the counter on your mirror site’s homepage is also displayed? In the next article, I will just introduce some ideas for providing free counters to your site members, which is basically an expansion of the content of this article.
The above has introduced the Geiger-Miller counter DIY three-step process for building a counter (Part 2), including the content of the Geiger-Miller counter. I hope it will be helpful to friends who are interested in PHP tutorials.