#!/usr/local/bin/perl ## G-LIGHT : admin.cgi ( 2003/10/13 ) ## Copyright (c) KentWeb ## webmaster@kent-web.com ## http://www.kent-web.com/ #------------# # 管理画面 # #------------# sub admin { if ($in{'pass'} eq "") { &enter; } elsif ($in{'pass'} ne $pass) { &error("パスワードが違います"); } # 削除 if ($in{'job'} eq "dele" && $in{'no'}) { # ロック開始 &lock if ($lockkey); @data=(); open(IN,"$logfile") || &error("Open Error: $logfile"); while () { ($no) = split(/<>/); $f=0; foreach $del ( split(/\0/, $in{'no'}) ) { if ($no == $del) { $f++; last; } } if (!$f) { push(@data,$_); } } close(IN); # 更新 open(OUT,">$logfile") || &error("Write Error: $logfile"); print OUT @data; close(OUT); # ロック解除 &unlock if ($lockkey); # 修正画面 } elsif ($in{'job'} eq "edit" && $in{'no'}) { if ($in{'no'} =~ /\0/) { &error("修正/レスは記事の選択は1つのみです"); } open(IN,"$logfile") || &error("Open Error: $logfile"); while () { @f = split(/<>/); last if ($in{'no'} == $f[0]); } close(IN); &edit_form(@f); # 修正実行 } elsif ($in{'job'} eq "edit2") { # ロック開始 &lock if ($lockkey); @data=(); open(IN,"$logfile") || &error("Open Error: $logfile"); while () { ($no,$dat,$nam,$eml,$area,$ico,$icom, $com,$res,$url,$hos,$pw,$sub,$tim) = split(/<>/); if ($in{'no'} == $no) { $_ = "$no<>$dat<>$in{'name'}<>$in{'email'}<>$in{'area'}<>$in{'icon'}<>$in{'icom'}<>$in{'comment'}<>$in{'comment2'}<>$in{'url'}<>$hos<>$pw<>$in{'sub'}<>$tim<>\n"; } push(@data,$_); } close(IN); # 更新 open(OUT,">$logfile") || &error("Write Error: $logfile"); print OUT @data; close(OUT); # ロック解除 &unlock if ($lockkey); } # 初期画面 &header; print <
  • 処理を選択して送信ボタンを押してください。
処理:
EOM # ログ展開 open(IN,"$logfile") || &error("Open Error: $logfile"); while () { ($no,$dat,$nam,$eml,$area,$ico,$icom, $com,$res,$url,$hos,$pw,$sub,$tim) = split(/<>/); $sub ||= '無題'; $com =~ s/
//g; if (length($com) > 60) { $com = substr($com,0,58) . '...'; } $res =~ s/
//g; if (length($res) > 60) { $res = substr($res,0,58) . '...'; } print "

$sub - $nam $dat
[本文] $com\n"; if ($res) { print "
[返信] $res\n"; } } close(IN); print <
EOM exit; } #------------# # 修正画面 # #------------# sub edit_form { local(@f) = @_; # アイコン定義 @ico1 = split(/\s+/, $ico1); @ico2 = split(/\s+/, $ico2); @ico3 = split(/\s+/, $ico3); &header; print <
  • 変更する部分のみ修正して送信ボタンを押してください。
EOM &form(@f); print < EOM exit; } #------------# # 入室画面 # #------------# sub enter { &header; print < パスワードを入力してください

EOM exit; } 1; __END__