Home > Backend Development > PHP Tutorial > Three Steps to DIY a Counter (Part 2)_PHP Tutorial

Three Steps to DIY a Counter (Part 2)_PHP Tutorial

WBOY
Release: 2016-07-21 16:05:57
Original
863 people have browsed it

This article will introduce how to put your own counter on your own mirror site.
Let me 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 the count1 in the previous article. Just change php.
First create a folder count, and put the files you want to use count2.php, count3.php..., for example, for 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: Be sure to put the complete path 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("");

Note:Don’t forget to put two dots before count, this is the complete path !
Finally, place the code at the appropriate location on your mirror site:

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template