#!/usr/bin/perl
##############################################################################
# shiromuku(u)PET version 2.00
# Created 02/13/00
# Copyright 2000 Shiromuku
# Available at http://www.t-okada.com/cgi/
###############################################################################
# COPYRIGHT NOTICE (著作権の告示)
# Copyright 2000 Shiromuku All Rights Reserved.
# This script can be used and modified free of charge as long as you don't
# change this header or any of the parts that give me credit for writing
# this. (このスクリプトは無償で使用または改変できます。ただしこの著作権の告知と上記のコメント、及びCGIにより生成されるHTML文書下部にある著作権表示部は変えないで下さい。)
# By using this script you agree to indemnify me from any liability
# that might arise from its use. In simple English, if this script somehow makes your computer run amuck and kill the pope, it's not my fault. (このスクリプトを使用することにより、使用者はその使用によって起こる可能性のあるいかなる事柄に対する責務についても、私Shiromukuに免責の保証を与えることに同意したものとします。)
# Redistributing and selling the code for this program without prior written consent is expressly forbidden. (前もって書面での承諾を得ることなくこのプログラムのコードを再配布したり売ったりすることは 明確に禁じられています。)
#######################
require './jcode.pl'; #変えないこと
require './su_pet_cfg.cgi'; #変えないこと
#ここから下の部分は、変更しなくて結構です。
#######################
&parse_data;
print "Content-type: text/html\n";
if ($usepasscookie == 1) {
&get_cookie;
$c_name = $COOKIE{'name'};
$c_email = $COOKIE{'email'};
$c_url = $COOKIE{'url'};
$c_pass = $COOKIE{'pass'};
$c_username = $COOKIE{'username'};
$c_password = $COOKIE{'password'};
if ($c_url eq '') {
$c_url = 'http://';
}
}
if ($action eq "delete_image_go_c") {
&delete_image_go_c;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "download_log") {
&download_log;
exit (0) ;
}
elsif ($action eq "admin") {
$txtnum = &get_number ("$section$txtnumfile", '1');
&return_admin;
exit (0) ;
}
elsif ($action eq "admin_cat") {
&return_admin_cat;
exit (0) ;
}
elsif ($action eq "admin_enter") {
&return_admin_enter;
exit (0) ;
}
elsif ($action eq "selectadmin") {
$txtnum = &get_number ("$section$txtnumfile", '1');
$txtnum = $lastnum;
&show_cat;
exit (0) ;
}
elsif ($action eq "user_a") {
&user_a;
exit (0) ;
}
elsif ($action eq "user") {
&user_a;
exit (0) ;
}
elsif ($action eq "selectadmin_cat") {
&select_admin_cat;
exit (0) ;
}
elsif ($action eq "add_cat_go") {
&add_cat_go;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "remove_cat_go") {
&remove_cat_go;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "change_cat_go") {
&change_cat_go;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "make_pass") {
&make_pass;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "changepassgo") {
&changepassgo;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "show_cat") {
$txtnum = &get_number ("$section$txtnumfile", '1');
&show_cat;
exit (0) ;
}
elsif ($action eq "showlast") {
$showsection = $FORM{'section'};
$txtnum = $lastnum;
&show_cat;
exit (0) ;
}
elsif ($action eq "remove") {
$txtnum = &get_number ("$section$txtnumfile", '1');
&remove;
&return_suc;
exit (0) ;
}
elsif ($action eq "settei") {
&settei;
&return_cat_suc;
exit (0) ;
}
elsif ($action eq "search_all_list") {
$txtnum = &get_number ("$section$txtnumfile", '1');
&search_all_list;
exit (0) ;
}
elsif ($action eq "search_all_lists") {
$txtnum = &get_number ("$section$txtnumfile", '1');
&search_all_lists;
exit (0) ;
}
&return_main;
exit (0) ;
############################
sub decrement_num {
my ($file) = $_[0];
my ($d_num) = $_[1];
my ($d_nums) = $d_num-1;
open(FILE,">$basedir/$file") || &error("ファイルがオープンできません。\n");
&lock;
print FILE "$d_nums";
&unlock;
close(FILE);
return $d_nums;
}
############################
sub increment_catnum {
$catnums = ++$catnum;
open(FILE,">$basedir/$catnumfile") || die $!;
&lock;
print FILE "$catnums";
&unlock;
close(FILE);
}
############################
sub parse_data {
if ($ENV{'REQUEST_METHOD'} eq "POST") {
&check_referer;
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
unless (($name eq "introduction") || ($name eq "title") || ($name eq "stylesheet") || ($name eq "back")) {
$value =~ s///g;
$value =~ s/<([^>]|\n)*>//g;
$value =~ s//g;
$value =~ s/</ig;
$value =~ s/>/>/ig;
}
$value =~ s/\|\|\|//g;
#$value =~ s/&/&/g;
$value =~ s/\r\n/
/g;
$value =~ s/\r/
/g;
$value =~ s/\n/
/g;
&jcode'convert(*value,$mycode);
if ($mycode eq 'sjis') { &jcode'h2z_sjis(*value); }
if ($mycode eq 'euc') { &jcode'h2z_euc(*value); }
$FORM{$name} = $value;
}
&get_var;
}
}
############################
#管理用ページに入る
sub return_admin_enter {
&head("管理用");
if ($FORM{'cat'}){
print "
\n";
print "
\n"; } &foot; } if ($FORM{'changepass'}){ &head("パスワードの変更"); print "