#! c:/perl/bin/perl # # phdisp2.cgi # # 1.0 : 7/31/06 : Created # # $Id: phdisp2.cgi,v 1.1 2006/07/31 05:56:18 Hideki Kanayama Exp $ # Copyright(c) 2006 Hideki Kanayama, all rights reserved # # SSIで呼び出す。 # # で起動できます。 # $imagedirにある写真をランダムに表示 # # use strict; use CGI::Carp qw(fatalsToBrowser); # リストファイル名 my $listfile = "listfile.dat"; my $version = "1.0"; my $lastupdatedyear = "2006"; my $script = "phdisp2.cgi"; my $lang = 0; my $charset = "Shift_JIS"; &display; exit; sub display { my @newlist; my @comlist; open(LISTFILE, "< $listfile") or &error("リストファイル$listfileが開けません"); my $i=0; while (){ chomp; ($newlist[$i],$comlist[$i]) = split /,/; $i++; } close(LISTFILE); my $imagefile; my $comment; my $randval = rand($i); $imagefile = $newlist[$randval]; $comment = $comlist[$randval]; print "Content-Type: text/html\n\n"; print "$comment\n"; print "\n"; } sub error { my ($msg) = shift; &htmlhead($msg); print "
$msg
\n"; print "
"; ©right; print "
"; &htmltail; exit; } sub htmlhead { my $title = shift; my $bgimage = "bgcolor=\"white\""; print "Content-Type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "$title\n"; print "\n"; print "\n"; } sub copyright { my $mysite = ('http://www.hidekik.com/','http://www.hidekik.com/en/')[$lang]; print "phdisp2.cgi Ver. $version
\n"; print "Copyright(C) $lastupdatedyear,
hidekik.com\n"; } sub htmltail { print "\n"; exit; }