一个简单计数器的源代码
发布时间:2006-10-14 2:44:29   收集提供:gaoqian
<?
$memo_file="phpcount/vst.txt";
if ($phpxcount<>$REMOTE_ADDR){
$visits = file($memo_file);
$number_of_last_visit = $visits[0];
$number_of_new_visit = ++$number_of_last_visit;
$fp = fopen($memo_file, "w");
$fw = fwrite($fp, $number_of_new_visit);
fclose($fp);

$len_str = strlen($number_of_new_visit);
for($i=(0);$i<$len_str;$i++){
$numbers_exploded = substr($number_of_new_visit,$i,1);
$output_str = $output_str . "<img src="$numbers_exploded.gif">";
}
}else{
$visits = file($memo_file);
$number_of_last_visit = $visits[0];
$number_of_new_visit = $number_of_last_visit;
$fp = fopen($memo_file, "w");
$fw = fwrite($fp, $number_of_new_visit);
fclose($fp);

$len_str = strlen($number_of_new_visit);
for($i=(0);$i<$len_str;$i++){
$numbers_exploded = substr($number_of_new_visit,$i,1);
$output_str = $output_str . "<img src="$numbers_exploded.gif">";
}
}
echo $output_str;
?>   
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50