#!/usr/local/bin/perl $nkf = '/usr/local/bin/nkf -j'; #$buffer = <>; # METHOD="POST" の場合。 $buffer = $ENV{'QUERY_STRING'}; # METHOD="GET" の場合。 @pairs = split(/\&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } open( OUT, "|$nkf"); select( OUT ); &print_header( $FORM{'m'} ); $picture = "/members/pictures/$FORM{'name'}.gif"; print "\"(^^)\""; &gf($FORM{'name'}); print "
\n"; print "
$FORM{'name'}\@lab3.kuis.kyoto-u.ac.jp
\n"; print "\n"; select( STDOUT ); close( OUT ); sub print_header { local( $lang ) = @_; print "Content-Type: text/html\n\n"; print "\n"; print "$FORM{'name'}'s portrait\n"; print "\n"; if( $lang =~ /j/ ){ #日本語 print '

京都大学'."\n"; print '工学部'."\n"; print '情報工学教室'."\n"; print '富田研究室'."\n"; print "

\n"; print "

私の顔

\n"; print "
\n"; } else { #英語 print '

Tomita Lab.,'; print 'Department of Information Science,
'; print 'Faculty of Engineering, Kyoto University
'; print "

\n"; print "

My Portrait

\n"; print "
\n"; } 1; } sub gf { local( $userid ) = @_; return unless ($userid ); $userid =~ s/\+.*//g; $userid =~ s/&.*//; $userid =~ s/@.*//; #そんな人はいない return unless ( getpwuid(getpwnam($userid)) eq $userid ); $yesfile = "/members/pictures/gf/gf.yes.gif"; $nofile = "/members/pictures/gf/gf.no.gif"; $whobuff = `/usr/bin/rwho|grep -v \'[0-9]+:[0-9]+ [0-9]+:*\$\'`; if ( grep(/$userid/,$whobuff) ){ print "\"I"; } else { print "\"I'm"; } return; } 1;