$ipcheck_max) array_shift($ip_list); } } // カウントファイル更新 if ($update) { $ip_buf = implode(",", array_values($ip_list)); $buf = implode("|", array($today_date, $yes_count, $today_count, $total_count, $ip_buf)); $fp = fopen($count_file, "w"); fputs($fp, $buf); fclose($fp); } // ロック解除 fclose($fp_lock); // 桁数整形 $yes_count_str = sprintf("%0".$fig1."d", $yes_count); $today_count_str = sprintf("%0".$fig2."d", $today_count); $total_count_str = sprintf("%0".$fig3."d", $total_count); $title = "Total:{$total_count_str} Today:{$today_count_str} Yesterday:{$yes_count_str}"; // タグを取得 $yes_count_str = outhtml($yes_count_str, $yes_counter_path); $today_count_str = outhtml($today_count_str, $today_counter_path); $total_count_str = outhtml($total_count_str, $total_counter_path); $size = getimagesize($today_img_path); $today_img = " \"today\""; $size = getimagesize($yes_img_path); $yes_img = " \"yesterday\""; echo ''.$total_count_str . $today_img . $today_count_str . $yes_img . $yes_count_str.''; } // カウント数とパスを与えて、IMGタグを返す function outhtml($f_cnt,$c_path) { $size = getimagesize($c_path. "0.gif"); // 0.gifからwidthとheight取得 for($i = 0; $i < strlen($f_cnt); $i++) { // 桁数分だけループ $n = substr($f_cnt, $i, 1); // 左から一桁ずつ取得 $i_tag .= "\"{$n}\""; } return $i_tag; } ?>