|
|
#!/usr/local/bin/perl
# **********************************************************
# HTTP ヘッダの出力
# **********************************************************
print "Content-Type: text/html; Charset=shift_jis\n\n";
# **********************************************************
# 標準入力より生データを入力
# **********************************************************
read( STDIN, $data, $ENV{"CONTENT_LENGTH"} );
# **********************************************************
# 生データを "&" を区切り文字にして、配列へ保存
# **********************************************************
@Fields_Data = split(/&/, $data);
# **********************************************************
# データのセットを連想配列に保存
# **********************************************************
foreach ( @Fields_Data ) {
($Name, $Value) = split( /=/, $_ );
$Value =~ tr/+/ /;
$Value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# &jcode'convert(*Value, "sjis");
$Form{$Name} = $Value;
}
if ($ENV{'REQUEST_METHOD'} eq "POST") {
if ( $Form{"command"} eq '色設定' ) {
}
if ( $Form{"command"} eq '送信' ) {
open(IN,"lightbox.log");
@lines = <IN>;
close(IN);
($sec,$min,$hour,$mday,$mon) = localtime(time);
$date = sprintf("%02d/%02d-%02d:%02d:%02d",$mon+1,$mday,$hour,$min,$sec);
open(OUT,">lightbox.log");
$Form{"Data"} =~ s/\r//g;
$Form{"Data"} =~ s/\n//g;
unshift ( @lines, $Form{'Handle'} . "\t" . $date . "\t" . $Form{"Data"} . "\n" );
print OUT @lines;
close(OUT);
&Reload;
}
}
if ( 1 ) {
print "<table border=1 cellpadding=5>";
while ( ($key,$val) = each %Form ) {
print "<tr>\n";
print "<td>$key</td>\n";
print "<td>$val</td>\n";
print "</tr>\n";
}
print "</table>";
}
print <<INPUT;
<HTML>
<HEAD>
<STYLE type="text/css">
.doumi { background-color:$color }
</STYLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=shift_jis">
</HEAD>
<BODY class=doumi>
<FORM method="POST" target="Input" action="input.cgi">
<TEXTAREA name="Data" cols="80" rows="10"></TEXTAREA>
<INPUT type=hidden name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="送信">
</FORM>
<FORM method="POST" target="Input" action="input.cgi">
<INPUT type=text name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="名前">
</FORM>
<FORM method="POST" target="Input" action="input.cgi">
<SELECT name=Color>
<OPTION>blue
<OPTION>red
<OPTION>pink
<OPTION>black
</SELECT>
<INPUT type=hidden name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="色設定">
</FORM>
</BODY>
</HTML>
INPUT
sub Reload {
print <<RELOAD;
<SCRIPT language=JavaScript>
parent.Output.location.reload(true);
</SCRIPT>
RELOAD
}
| |
|
|
|
|
#!/usr/local/bin/perl
$path = "/cgi/doumi/";
$maxline = "50";
$debug = 0;
&FormIn;
# **********************************************************
# HTTP ヘッダの出力
# **********************************************************
print "Content-Type: text/html; Charset=shift_jis\n";
if ( $Form{"command"} eq '色設定' ) {
print "Set-Cookie: color=$Form{'Color'}; Fri, 31-Dec-2030 23:59:59;\n";
}
print "\n";
# **********************************************************
# クッキーによる背景色設定
# **********************************************************
if ( $ENV{'HTTP_COOKIE'} ne "" ) {
@ccolor = split( /=/, $ENV{'HTTP_COOKIE'} );
$color = $ccolor[1];
}
# **********************************************************
# 送信ボタンの処理
# **********************************************************
if ($ENV{'REQUEST_METHOD'} eq "POST") {
if ( $Form{"command"} eq '色設定' ) {
$color = $Form{'Color'};
}
if ( $Form{"command"} eq '送信' ) {
open(IN,$path . "light.log");
@lines = <IN>;
close(IN);
splice(@lines, $maxline-1);
($sec,$min,$hour,$mday,$mon) = localtime(time);
$date = sprintf("%02d/%02d-%02d:%02d:%02d",$mon+1,$mday,$hour,$min,$sec);
open(OUT,">" . $path . "light.log");
$Form{"Data"} =~ s/\r//g;
$Form{"Data"} =~ s/\n//g;
unshift ( @lines, $Form{'Handle'} . "\t" . $date . "\t" . $Form{"Data"} . "\n" );
print OUT @lines;
close(OUT);
&Reload;
}
}
# **********************************************************
# デバッグ表示
# **********************************************************
if ( $debug == 1 ) {
print "$ENV{'HTTP_COOKIE'}\n";
print "<table border=1 cellpadding=5>";
while ( ($key,$val) = each %Form ) {
print "<tr>\n";
print "<td>$key</td>\n";
print "<td>$val</td>\n";
print "</tr>\n";
}
print "</table>";
}
# **********************************************************
# 画面の表示
# **********************************************************
print <<INPUT;
<HTML>
<HEAD>
<STYLE type="text/css">
.doumi { background-color:$color }
</STYLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=shift_jis">
</HEAD>
<BODY class=doumi>
<FORM method="POST" target="Input" action="input.cgi">
<TEXTAREA name="Data" cols="80" rows="10"></TEXTAREA>
<INPUT type=hidden name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="送信">
</FORM>
<FORM method="POST" target="Input" action="input.cgi">
<INPUT type=text name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="名前">
</FORM>
<FORM method="POST" target="Input" action="input.cgi">
<SELECT name=Color>
<OPTION>blue
<OPTION>red
<OPTION>pink
<OPTION>black
</SELECT>
<INPUT type=hidden name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="色設定">
</FORM>
</BODY>
</HTML>
INPUT
# **********************************************************
#
# **********************************************************
sub Reload {
print <<RELOAD;
<SCRIPT language=JavaScript>
parent.Output.location.reload(true);
</SCRIPT>
RELOAD
}
# **********************************************************
#
# **********************************************************
sub FormIn {
read( STDIN, $data, $ENV{"CONTENT_LENGTH"} );
@Fields_Data = split(/&/, $data);
foreach ( @Fields_Data ) {
($Name, $Value) = split( /=/, $_ );
$Value =~ tr/+/ /;
$Value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$Form{$Name} = $Value;
}
}
| |
|
|
|
|
#!/usr/local/bin/perl
$path = "/cgi/doumi/";
$maxline = "50";
$debug = 0;
&FormIn;
# **********************************************************
# HTTP ヘッダの出力
# **********************************************************
print "Content-Type: text/html; Charset=shift_jis\n";
if ( $Form{"command"} eq '色設定' ) {
print "Set-Cookie: color=$Form{'Color'}; Fri, 31-Dec-2030 23:59:59;\n";
}
print "\n";
# **********************************************************
# クッキーによる背景色設定
# **********************************************************
if ( $ENV{'HTTP_COOKIE'} ne "" ) {
@ccolor = split( /=/, $ENV{'HTTP_COOKIE'} );
$color = $ccolor[1];
}
# **********************************************************
# 送信ボタンの処理
# **********************************************************
if ($ENV{'REQUEST_METHOD'} eq "POST") {
if ( $Form{"command"} eq '色設定' ) {
$color = $Form{'Color'};
}
if ( $Form{"command"} eq '送信' ) {
open(IN,$path . "light.log");
@lines = <IN>;
close(IN);
splice(@lines, $maxline-1);
($sec,$min,$hour,$mday,$mon) = localtime(time);
$date = sprintf("%02d/%02d-%02d:%02d:%02d",$mon+1,$mday,$hour,$min,$sec);
open(OUT,">" . $path . "light.log");
$Form{"Data"} =~ s/\r//g;
$Form{"Data"} =~ s/\n//g;
unshift ( @lines, $Form{'Handle'} . "\t" . $date . "\t" . $Form{"Data"} . "\n" );
print OUT @lines;
close(OUT);
&Reload;
}
}
# **********************************************************
# デバッグ表示
# **********************************************************
if ( $debug == 1 ) {
print "$ENV{'HTTP_COOKIE'}\n";
print "<table border=1 cellpadding=5>";
while ( ($key,$val) = each %Form ) {
print "<tr>\n";
print "<td>$key</td>\n";
print "<td>$val</td>\n";
print "</tr>\n";
}
print "</table>";
}
# **********************************************************
# 画面の表示
# **********************************************************
print <<INPUT;
<SCRIPT language=JavaScript>
function CheckName()
{
if ( document.all.item("Handle")(1).value == "" ) {
alert("お名前を入力して下さい");
document.all.item("Handle")(1).focus(); return false;
}
return true;
}
function CheckData(){
if ( document.all.item("Data").value == "" ) {
alert("データを入力して下さい");
document.all.item("Data").focus();
return false;
}
if ( CheckName() == false ) {
return false;
}
return true;
}
</SCRIPT>
<HTML>
<HEAD>
<STYLE type="text/css">
.doumi { background-color:$color }
</STYLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=shift_jis">
</HEAD>
<BODY class=doumi>
<TABLE border=0>
<TR>
<TD>
<FORM method="POST" target="Input" action="input.cgi" onSubmit='return CheckData();'>
<TEXTAREA name="Data" cols="80" rows="10"></TEXTAREA>
<INPUT type=hidden name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="送信">
</FORM>
</TD>
<TD>
<FORM method="POST" target="Input" action="input.cgi" onSubmit='return CheckName();'>
<INPUT type=text name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="名前">
</FORM>
<FORM method="POST" target="Input" action="input.cgi">
<SELECT name=Color>
<OPTION>blue
<OPTION>red
<OPTION>pink
<OPTION>black
</SELECT>
<INPUT type=hidden name=Handle value="$Form{'Handle'}">
<INPUT type="submit" name="command" value="色設定">
</FORM>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
INPUT
# **********************************************************
#
# **********************************************************
sub Reload {
print <<RELOAD;
<SCRIPT language=JavaScript>
parent.Output.location.reload(true);
</SCRIPT>
RELOAD
}
# **********************************************************
#
# **********************************************************
sub FormIn {
read( STDIN, $data, $ENV{"CONTENT_LENGTH"} );
@Fields_Data = split(/&/, $data);
foreach ( @Fields_Data ) {
($Name, $Value) = split( /=/, $_ );
$Value =~ tr/+/ /;
$Value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$Form{$Name} = $Value;
}
}
| |
|
|
|