%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/rappan/www/cgi_up_home/
Upload File :
Create Path :
Current File : /home/rappan/www/cgi_up_home/diary.cgi

#!/usr/bin/perl

#diary ver.18

#--------ライブラリ読込み------------------------

$commonpl='lib/common.pl';
if(!-e $commonpl){
	&error("$commonplがありません。");
}
require $commonpl;

$common2pl='lib/common2.cgi';
if(!-e $common2pl){
	&error("$common2plがありません。");
}
require $common2pl;

#-------変数-------------------------------------

$t_size='10pt';
$t_color='#000000';
$l_color='#0000ff';
$b_color='#ffffff';
$maxsize='10000';

#-----------------------------------------------

if($hostdeny){
	$host=&GetHost;
	&HostDeny($host);
}

$FORM{'page'}=0;

if($ENV{'REQUEST_METHOD'} eq "POST"){
	if($ENV{'CONTENT_LENGTH'}>$maxsize){
		&error("投稿量が多すぎます。");
	}
	read(STDIN,$buff,$ENV{'CONTENT_LENGTH'});
}
else{
	$buff=$ENV{'QUERY_STRING'};
}
if($buff){
	&Decode;
}

sub Decode{
my(@pairs,$pair,$name,$value);
@pairs=split(/&/,$buff);
foreach $pair(@pairs){
	($name,$value)=split(/=/,$pair);
	$FORM{$name}=$value;
}
}


&Html;


sub GetHost{
my($host);
$host=$ENV{'REMOTE_HOST'} || $ENV{'REMOTE_ADDR'};
return $host;
}

sub HostDeny{
my($host);
$host=$_[0];
foreach(@kinsihost){
	if($host=~/$_/){
		&error("アクセスできません。");
	}
}
}

sub Html{
my(
$href,$href2,$real_w,$real_h,$c,$page_next,$page_back,$i,$start,$end,@all,
$dmy,$table_d,$dummy,$head,$foorer,$table,$no,$resno,$name,$fukidashi,$subject,
$date,$message,$icon,$weather,$color,$imgfile,$w,$h,$skinline,$footer,$ratio,$wh,
$nextform,$backform,$pagetmp,$oya_d,$oya,$x,$hd,
);

if($upimgdir_http){
	$upimgdir=$upimgdir_http;
}
if($imgdir_http){
	$imgdir=$imgdir_http;
}

unless(open(HTML, $html)){
	&error("$htmlが開けません。ファイルを確認してください。");
}

$skinline=join('',<HTML>);
close(HTML);
($head,$dummy)=split(/<!--msgstart-->/,$skinline);
if($head eq ""){
	&error("スキンに&lt;!--msgstart--&gt;が書かれていません。");
}
($table,$footer)=split(/<!--msgend-->/,$dummy);
if($footer eq ""){
	&error("スキンに&lt;!--msgend--&gt;が書かれていません。");
}
unless(open(FILE,$logfile)){
	&error("$logfileが開けません。ファイルを確認してください。");
}
$hd=<FILE>;
($dmy,$oya)=split(/,/,$hd);

print "Content-type: text/html\n\n";
print $head;

$start=$FORM{'page'}+1;
$end=$FORM{'page'}+$pagemax;
$i=0;
while (<FILE>){
	($no,$name,$fukidashi,$subject,$date,$message,$icon,$weather,$color,$imgfile,$w,$h)=split(/,/,$_);
	$i++;
	if($i > $end){
		last;
	}
	if($i < $start){
		next;
	}
	if($icon){
		$icon="<img src=\"$imgdir$icon\" border=\"0\" alt=\"\" ${iconsize}>";
	}
	if($imgfile){
		$href="";
		$href2="";
		if($w && $h && $w > 0 && $h > 0){
			$real_w=$w+40;
			$real_h=$h+40;
			if($w > $w_max) {
				$w_o=$w;
				$w=$w_max;
				$h=int($w*$h/$w_o);
				$href=qq(<a href="javascript:void(0);" onclick="openwin('${upimgdir}$imgfile',${real_w},${real_h});">);
				$href2="</a>";
			}
			$wh="width=\"$w\" height=\"$h\"";
		}
		$imgfile=qq(${href}<img src="${upimgdir}$imgfile" border="0" align="${i_align}" ${wh} ${img_style}>${href2});
	}

	$table_d=$table;
	$table_d=~s/<!--icon-->/$icon/;
	$table_d=~s/#color/$color/;
	$table_d=~s/<!--subject-->/$subject/;
	$table_d=~s/<!--upfile-->/$imgfile/;
	$table_d=~s/<!--message-->/$message/;
	$table_d=~s/<!--name-->/$name/;
	$table_d=~s/<!--date-->/$date/;
	print $table_d;
}
close FILE;

$page_next=$FORM{'page'}+$pagemax;
$page_back=$FORM{'page'}-$pagemax;

if($page_back>=0){
$pagetmp.="<a href=\"$script?page=$page_back\"><<前へ</a>&nbsp;&nbsp;";

}
if($page_next<$oya){
$pagetmp.="<a href=\"$script?page=$page_next\">次へ>></a>&nbsp;&nbsp;";
}



$footer=~s/<!--page-->/$pagetmp/;

print $footer;
exit;
}


sub header{
print <<EOM;
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
<!--
p,td,div{
font-size: 10pt;
}
a{
color: ${l_color};
text-decoration:none
}

-->
</style>
</head>
EOM
}


sub error{

&header;

print <<EOM;
<body>
<br>
<br>
<p align="center"><font color="#ff0000">ERROR</font><br><br>
EOM
print"$_[0]\n";
print <<EOM;
</p>
<p align="center"><a href="${script}?">日記画面に戻る</a></p>
</body>
</html>
EOM
exit;
}
exit;

Zerion Mini Shell 1.0