瀏覽代碼

Added server-side username to output.

Alois Mahdal (@azzgoat) 12 年之前
父節點
當前提交
c05b6197e5
共有 1 個檔案被更改,包括 2 行新增1 行删除
  1. 2
    1
      cgi-bin/hello_host.cgi

+ 2
- 1
cgi-bin/hello_host.cgi 查看文件

21
 my $myport = $ENV{'SERVER_PORT'};
21
 my $myport = $ENV{'SERVER_PORT'};
22
 my $myhostname = hostname;
22
 my $myhostname = hostname;
23
 my $mylocaltime = &mygetstrtime;
23
 my $mylocaltime = &mygetstrtime;
24
+my $username = getpwuid( $< );
24
 
25
 
25
 print "Client:\n";
26
 print "Client:\n";
26
 print "  $ip:$port\n";
27
 print "  $ip:$port\n";
27
 print "\n";
28
 print "\n";
28
 print "Server:\n";
29
 print "Server:\n";
29
 print "  $myip:$myport\n";
30
 print "  $myip:$myport\n";
30
-print "  $myhostname:$myport\n";
31
+print "  $username\@$myhostname:$myport\n";
31
 print "  $mylocaltime\n";
32
 print "  $mylocaltime\n";
32
 
33