The counter has seen many such examples in Osso before, each method is complex, see the following example realizes the graph counter. Use in Web pages please use <script src= "http://file address" ></script>
?
A text file that holds the count
$count = "Count.txt";
Number of digits of the counter, if not filled, default to 6-bit
$wei = "";
The URL path of the image
$tu = "Http://127.0.0.1/tcount/images";
?>
?
if ($wei = = "") {$wei = 6;}
if (!file_exists ($count)) {$fp =fopen ($count, "w+"); Fputs ($fp, 0,100); fclose ($FP);}
if ($REMOTE _addr!= $ip) {
$FP =fopen ($count, "r+");
$CC =fgets ($fp, 100);
$CC =trim ($CC);
if ($cc = = "") {$cou = 1;}
else {$cou = $CC +1;}
Rewind ($FP);
Fputs ($fp, $cou, 100);
Fclose ($FP);
}
Setcookie ("IP", $REMOTE _addr,time () +86400);
$FP =fopen ($count, "r+");
$cou =fgets ($fp, 100);
$cou =trim ($cou);
Fclose ($FP);
$w =strlen ($cou);
while ($w < $wei) {
$cou = "0". $cou;
$w + +;
}
$www =strlen ($cou);
$i = 0;
echo "document.write (" <p align=center> ");";
while ($i < $www) {
$ym =substr ($cou, $i, 1);
echo "document.write (" ");";
$i + +;
}
?>
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.