This article describes how to add counters on your own image website.
Assume that you have multiple image sites as an example. First, insert several new data num and visited into the data table, which will be used on your image site, change count1.php in the previous article.
Create a folder named count and put the count2.php, count3.php, and so on ......, For example, change 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 = " ";
Echo $ tmpstr;
}
?>
Note: "After completing this step, we will create a folder show with the corresponding file show2.php,
Show3.php ......, Take show2.php as an example. Write the source code as follows:
Document. Write ("<a href = http://cnfree.oso.com.cn target = _ blank Title = China free resource information Alliance> <? Include "../count/count2.php"?> </A> ");
Note: <? Include "../count/count2.php"?> Don't forget to add two points before count. This is the complete path!
Finally, placeCode:
<Script language = JavaScript src = http://cnfree.oso.com.cn/show/show2.php> </SCRIPT>
Http://cnfree.oso.com.cn is my space on Oso, you can switch to your own!
Okay, everything is OK! Check whether the counters on the home page of your image site are displayed? In the next article, I will introduce some ideas about how to provide free counters to your website Members, which is basically an extension of this article.