$msg
\n";
print "\n";
if ($in{mode} eq 'setup'){
print "\n";
print "\n";
} else {
print "\n";
print "\n";
}
print "";
©right;
&htmltail;
exit;
}
sub wradminpwd {
my $plain = shift;
my $passwd = &makecrypt($plain);
if (open(FILE,"> $admindat")){
print FILE "$passwd";
close(FILE);
} else {
&error('パスワードファイル作成に失敗しました');
}
}
sub checkcrypt {
my ($pwd,$encpwd)=@_;
return(crypt($pwd,$encpwd) eq "$encpwd" or &checkadmin);
}
sub postprocess {
my $key;
foreach $key (keys %in){
my $br;
if ($key !~ /insert/){
$in{$key} =~ s/</g;
$in{$key} =~ s/>/>/g;
}
$br = "
";
if ($in{$key} =~ /\r\n/) { $in{$key} =~ s/\r\n/$br/g; }
if ($in{$key} =~ /\n/) { $in{$key} =~ s/\n/$br/g; }
if ($in{$key} =~ /\r/) { $in{$key} =~ s/\r/$br/g; }
if ($in{$key} =~ /,/) { $in{$key} =~ s/,/&\#44;/g; }
}
}
sub checkadmin {
my $pwd = shift;
if (open(FILE,"< $admindat")){
my $filepwd = ;
close(FILE);
my $inpwd = crypt($pwd,$filepwd);
return ("$inpwd" eq "$filepwd");
} else {
&error((('パスワードファイルが存在しません','Cannot find password file')[$lang]));
}
}
sub error {
my ($msg) = shift;
&unlockfile;
&htmlhead($msg);
print "
$msg";
print "";
&backbutton;
print "
\n";
©right;
&htmltail;
exit;
}
sub unlockfile {
unlink("tmp.$$") if (-e "tmp.$$");
unlink("$lockfile") if (-e $lockfile);
}
sub lockfile {
while(-e "$lockfile"){
sleep(1);
}
open(LOCK,"> $lockfile");
close(LOCK);
}
sub titleprint {
my ($title,$logo,$style,$color,$size,$face,$sel,$loc)=@_;
my @location = ('left','center','right');
my $titleline;
if ($sel == 0) {
$titleline = "$title
";
} elsif ($sel == 1){
$titleline = "$title
";
} elsif ($sel == 2){
$titleline = "
";
} elsif ($sel == 3){
$titleline = "$title
";
} elsif ($sel == 4){
$titleline = "";
}
return($titleline);
}
sub htmlhead {
my $title = shift;
my $bgimage;
if ($bgimage_en == 1){
$bgimage = "background=\"$bgimage_file\"";
} else {
$bgimage = "bgcolor=\"$bgcolor\"";
}
print $q->header(-type=>'text/html',-charset=>$charset);
print "\n";
print "\n";
print "$title\n";
if ($head_insert_en == 1){
print "$head_insert\n";
}
if ($style_sheet_en == 1){
print "\n";
}
print "\n";
print "\n";
print "\n";
}
sub copyright {
my $mysite = ('http://www.hidekik.com/','http://www.hidekik.com/en/')[$lang];
print "jl3.cgi Ver. $version ";
print "Copyright(C) 2002-$lastupdatedyear, hidekik.com \n";
}
sub htmltail {
print " |
\n";
}
sub setup {
my $subname = 'setup';
&setadminpwd if ($in{pwd} eq '');
&error(('管理用パスワードが違います。','Wrong admin password')[$lang]) unless &checkadmin($in{pwd});
&htmlhead($title);
my %check;
$check{backlink}[$backlink_en] = "checked";
$check{bgimage}[$bgimage_en] = "checked";
$check{logo_sel}[$logo_sel] = "checked";
$check{logo_loc}[$logo_loc] = "checked";
$check{setup}[$setup_en] = "checked";
$check{tag}[$tag_en] = "checked";
$check{number}[$number_en] = "checked";
$check{style_sheet}[$style_sheet_en] = "checked";
$check{head_insert}[$head_insert_en] = "checked";
$check{body_insert1}[$body_insert1_en] = "checked";
$check{body_insert2}[$body_insert2_en] = "checked";
$check{body_insert3}[$body_insert3_en] = "checked";
print "";
©right;
&htmltail;
}
sub setupwrite {
&error(('管理人パスワードが違います','Wrong admin password')[$lang]) unless ( &checkadmin($in{pwd}));
$in{logo_size} =~ s/ /+/;
foreach (keys(%in)){
$in{$_} =~ s/
/\n/g;
$in{$_} =~ s/&\#44;/,/g;
$in{$_} =~ s/<//g;
}
open(SETUP,"> $setupfile");
print SETUP <