1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/perl -wT
-
- use strict;
- use warnings;
-
- use Sys::Hostname;
-
- sub mygetstrtime {
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time);
- $year += 1900; $mon += 1;
- return sprintf "%02d/%02d/%04d %02d:%02d:%02d", $mon, $mday, $year, $hour, $min, $sec;
- }
-
- print "Content-type: text/plain; charset=utf-8\n";
- print "Pragma: no-cache\n";
- print "Cache-Control: no-cache\n\n";
-
- my $ip = $ENV{'REMOTE_ADDR'};
- my $port = $ENV{'REMOTE_PORT'};
- my $myip = $ENV{'SERVER_ADDR'};
- my $myport = $ENV{'SERVER_PORT'};
- my $myhostname = hostname;
- my $mylocaltime = &mygetstrtime;
- my $username = ( $^O eq "MSWin32" ? '' : getpwuid( $< ));
-
- print "Client:\n";
- print " $ip:$port\n";
- print "\n";
- print "Server:\n";
- print " $myip:$myport\n";
- print " $username\@$myhostname:$myport\n";
- print " $mylocaltime\n";
|