#!/usr/bin/perl

print "Content-type: text/html\n\n\n";

require 'jcode.pl';

$logfile="/export/www/yayoi/regist-log";
$homeurl="../";

if($cgi{'lang'} eq "en") {
    $registurl="../regist-e.html";
} else {
    $registurl="../regist.html";
}    

$myname="くみちょ";
$mymail="kumicho\@lares.dti.ne.jp";
$mailto="/bin/mail " . $mymail;

open(FILE,"$logfile");

print &print_euc(<<EOF);
<html>
<head><title>Visitors List</title></head>
<body bgcolor="#ccccff">
    <hr>登録された先輩のリストですぅ(since Jan 13 1997)
EOF

$counter=0;

while(<FILE>) {
    chop;
    if(/name:(.*)$/) {
	$counter++;
	$name=$1;
    } else {
	if(/url:(.*)$/) {
	    if($1 ne "<NONE>") {
		print &print_euc(<<EOF);
<hr>
$counter:<a href="$1">$name 先輩</a>
EOF
	    } else {
		print &print_euc(<<EOF);
<hr>
$counter:$name 先輩
EOF
	    }
	} else {
	    if(/who:(.*)$/) {
		print &print_euc(<<EOF);
　お気に入り:$1<br><br>
EOF
	    } else {
		if(/msg:(.*)$/) {
		print &print_euc(<<EOF);
ひとこと:<br>
$1<p>
EOF
		}
	    }
	}
    }
}
close(FILE);

print &print_euc(<<EOF);
<hr>
<a href="$registurl">[登録ページ]</a>
<a href="$homeurl">[トップページ]</a>
<hr><address>
<a href="mailto:kumicho\@lares.dti.ne.jp">インターネット弥生組組長</a>
</address>
</body></html>
EOF

sub print_jis{
  local($value) = @_;
  &jcode'convert(*value, 'jis');
  $value;
}

sub print_euc{
  local($value) = @_;
  &jcode'convert(*value, 'euc');
  $value;
}
