|
お箸 の持ち方 まちがっていませんか?
私たちが毎日のように使うお箸
実は知らないことばかりなんです!
[フレームあり] [フレームなし]
あなたは#!/usr/bin/perl
$countfile = "pcnt.dat";
$picdir = 'http://contest2007.thinkquest.jp/tqj2007/90212';
$widthheight = 'WIDTH=18 HEIGHT=20';
$uselock = 1;
print "Content-type: text/html\n\n";
if (!open(OUT, "+<$countfile")) {
print "ttt";
exit(0);
}
if (!&lock_file(OUT)) {
print "busy";
exit(0);
}
seek(OUT, 0, 0);
$totalcount = 1 + ;
$yesterdaycount = 0 + ;
$todaycount = 1 + ;
$lastday = ;
( $sec, $min, $hour, $day, $mon, $year ) = localtime(time);
$mon++;
$year += 1900;
$today = "$year-$mon-$day\n";
if ($today ne $lastday) {
( $sec2, $min2, $hour2, $day2, $mon2, $year2 ) = localtime(time - 24*60*60);
$mon2++;
$year2 += 1900;
$yesterday = "$year2-$mon2-$day2\n";
if ($yesterday ne $lastday) {
# 昨日はアクセスしなかった
$yesterdaycount = 0;
} else {
$yesterdaycount = $todaycount - 1;
}
$todaycount = 1;
$lastday = $today;
}
seek(OUT, 0, 0);
print OUT "$totalcount\n";
print OUT "$yesterdaycount\n";
print OUT "$todaycount\n";
print OUT "$lastday";
&unlock_file(OUT);
close(OUT);
$yesterdaytag = &get_img($yesterdaycount);
$todaytag = &get_img($todaycount);
$totaltag = &get_img($totalcount);
print "$totaltag\n";
exit(0);
sub get_img {
local($count) = @_;
local($img) = '';
@numberarray = split(//, $count);
foreach $number (@numberarray) {
$img .= "
|
|