Create counter DIY three-step (middle) _php Foundation

Source: Internet
Author: User
This article will introduce your own counter on the mirror.
Let me assume that you have more than one mirror as an example, first in the datasheet inserts a few new data num, visited, which will be used in your mirror station, as long as the count1.php in the previous article can be changed.
First set up a folder count, which contains the file you want to use count2.php,count3.php ..., for example, such as Count2 source code, will 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: "After this step, we'll create a folder show with the corresponding file show2.php,
Show3.php ..., take 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 "?></a>");

Note:? Include ".. /count/count2.php "?> do not forget the count before the two points, this is the full path!"
Finally, place the code at the appropriate location on your mirror:
<script Language=javascript src=http://cnfree.oso.com.cn/show/show2.php></script>
Http://cnfree.oso.com.cn is my space on the Oso, you can change your own!
All right, all ok!. Look at your Mirror station home page counters are also displayed? The next chapter I just introduced to your site members to provide free counter some ideas, is basically the content of some of the expansion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.