root/trunk/dlcounter/cclib.pl

Revision 115, 3.0 kB (checked in by akiyan, 2 years ago)

maintenance

Line 
1 #----�t�H�[���̓����
2 sub formdecord {
3         local($a, $name, $value);
4         if ($ENV{'REQUEST_METHOD'} eq "POST") {
5                 read(STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
6         } else {
7                 $query_string = $ENV{'QUERY_STRING'};
8         }
9         @a = split(/\&/, $query_string);
10         foreach $a (@a) {
11                 ($name, $value) = split(/=/, $a);
12                 $value =~ tr/+/ /;
13                 $value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
14                 if ( $_[0] ne "" ) {
15                         &jcode'convert(*value, "$_[0]", "", "z");
16                 }
17                 $FORM{$name} = $value;
18         }
19 }
20 1;
21
22 #----�t�@�C���̑����𓾂�sub filestatus {
23         ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,$atime, $mtime, $ctime, $blksize, $blocks) = stat($_[0]);
24 }
25
26 #----�N�b�L�[�ǂݍ���
27 sub getcookie {
28         local($xx, $name, $value);
29         foreach $xx (split(/; */, $ENV{'HTTP_COOKIE'})) {
30                 ($name, $value) = split(/=/, $xx);
31                 $value =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C", hex($1))/eg;
32                 $COOKIE{$name} = $value;
33         }
34 }
35 1;
36
37 #----html�w�b�_�\��
38 sub htmlheader {
39         print "Content-type: text/html\n\n";
40 }
41 1;
42
43 #----�����j����sub maketime {
44         ($sec, $min, $hour, $mday, $mon, $year,$wday, $yday, $isdst) = localtime($_[0]);
45         $year += 1900;
46         $mon++;
47         if ( $mon < 10 ) { $mon = '0'.$mon ; }
48         if ( $mday < 10 ) { $mday = '0'.$mday ; }
49         if ( $hour < 10 ) { $hour = '0'.$hour ; }
50         if ( $min < 10 ) { $min = '0'.$min ; }
51 }
52 1;
53
54 #----HTTP�w�b�_�[�p�������sub time2str (;$)
55 {
56         @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
57         @MoY = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
58         @MoY{@MoY} = (1..12);
59         my $time = shift;
60         $time = time unless defined $time;
61         my ($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($time);
62         sprintf("%s, %02d %s %04d %02d:%02d:%02d GMT",
63                 $DoW[$wday],
64                 $mday, $MoY[$mon], $year+1900,
65                 $hour, $min, $sec);
66 }
67 1;
68
69 #---��HTML�o��
70 sub puthtml {
71         if ( $_[0] eq "top" ) {
72                 print <<"EOT";
73 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
74 <html lang="ja">
75 <head>
76 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
77 <meta http-equiv="Content-Style-Type" content="text/css" />
78 <meta http-equiv="content-script-type" content="text/JavaScript" />
79 <title>$_[1]</title>
80 <STYLE TYPE="text/css">
81 <!--
82 h1 {
83  font-size:100%;
84  margin-bottom:1em;
85  border-color:$admin_bordercolor;
86  border-top-width: 0px;
87  border-right-width: 0px;
88  border-bottom-width: 3px;
89  border-left-width: 0px;
90  border-style: solid;
91  padding-bottom: 0px;
92 }
93
94 h2,h3,h4,h5,h6,body,table {
95  font-size:100%;
96 }
97
98 .copyright {
99  text-align:right;
100  margin-top:1em;
101  border-color:$admin_bordercolor;
102  border-top-width: 3px;
103  border-right-width: 0px;
104  border-bottom-width: 0px;
105  border-left-width: 0px;
106  border-style: solid;
107  padding-top: 0px;
108 }
109
110 -->
111 </STYLE>
112 </head>
113 <body style="font-color:$_[2];bacground-color:$_[3]">
114 <h1>�� $_[1]</h1>
115 EOT
116
117         }
118
119         if ( $_[0] eq "bottom" ) {
120                 print <<"HTML";
121 <div class="copyright">
122 <strong>&copy;�~�ϑ���l <a href="http://www.akiyan.com/">http://www.akiyan.com/</a></strong>
123 </div>
124 </body>
125 </html>
126 HTML
127
128         }
129 }
130 1;
Note: See TracBrowser for help on using the browser.