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, in the count2 source code, you can use cou to describe how to add counters on your own image site.
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 this step is completed, create a folder show, and put the corresponding file show2.php in it,
Show3.php ......, Take show2.php as an example. write the source code as follows:
Document. write ("http://cnfree.oso.com.cn target = _ blank title = China free resource information alliance> ");
Note: Don't forget to add two points before count. this is the complete path!
Finally, place the code in the appropriate location on your image site:
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.