List of gd/jpgctr.cgi

Sun Dec 16 05:58:50 2018

戻る

TEXTAREA で表示(カット&ペーストむき)

#!/usr/local/bin/perl5
#
# jpgctr.cgi
#
# Copyright 2000 gama <gama@mvg.biglobe.ne.jp>
#
# 2000/11/12 Ver0.01
# 2000/11/15 Ver0.03
{
	$LOCK_EX	=2;

	open(FCTR,"+<ctr.dat");
	flock(FCTR,$LOCK_EX);		# 排他 lock
	$num=<FCTR> + 1;
	seek(FCTR, 0, 0);
	printf(FCTR "%d", $num);
	close(FCTR);

	my($sec,$min,$hour,$mday,$mon,$year)=localtime;
	if ( $hour >= 12 ) {
		$ampm="pm";
		$hour=$hour-12;
	} else {
		$ampm="am";
	}

	$str  = sprintf("[%2.2d\/%2.2d\/%2.2d %2.2d\:%2.2d\:%2.2d%s] %6.6d", 
					 $year%100, $mon+1, $mday,
					 $hour, $min, $sec, $ampm,
					 $num
					 );
	$|	 =1;
	print ("Content-type: image/jpeg\n");
	print ("Pragma: no-cache\n\n");
	system("./str2jpg \"$str\"");
}

戻る