Before House Orso near saw a lot of such examples, each method is complex, see the following example to implement a graphical counter. Use in Web pages
Text file that holds the count
$count = "Count.txt";
The number of bits of the counter, which defaults to 6 bits if not filled
$wei = "";
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 (\")
\ "); \ n";
while ($i < $www) {
$ym =substr ($cou, $i, 1);
echo "document.write (\" \ "); \ n";
$i + +;
}
?>
http://www.bkjia.com/PHPjc/315813.html www.bkjia.com true http://www.bkjia.com/PHPjc/315813.html techarticle before House Orso near saw a lot of such examples, each method is complex, see the following example to implement a graphical counter. Use the script src=http://file address in the Web page,/script? Store ...