# データファイル名 $userdata = './user.dat'; # 来客者情報が入ってるデータ $petdata = './pet.dat'; # ペットの情報が入ってるデータ $lockkey = 1; # ファイルのロック(0=no 1=mkdir 2=symlink) Amend Ver 2.2 $lockfile = './petlock'; # ロックファイル名 $method = 'POST'; # POSTかGETを選択 $salt=12345678; # 換字暗号化・解読 任意の数値(8桁程度) |
print "<tr>\n";
print "<td colspan=\"2\">\n";
print "<div align=\"right\">\n";
&input('hidden','name',$FORM{'name'},'','');
&input('hidden','pass',$FORM{'pass'},'','');
# &input('hidden','good',"$scheduledsr[$timeafter]$plusfeed",'','');
# &input('hidden','bad',"$schedulednt[$timeafter]$minusfeed",'','');
$water=time;
&init_cipher;
$plustxt = &cipher("$scheduledsr[$timeafter]$plusfeed");
$minustxt = &cipher("$schedulednt[$timeafter]$minusfeed");
&input('hidden','key',"$water",'','');
&input('hidden','good',"$plustxt",'','');
&input('hidden','bad',"$minustxt",'','');
&input('submit','','OK!','','<br>');
print "</div>\n";
&tablebottom;
} else { $actionflag = 1 }
&bodybottom;
&openoutpetdata;
&footer;
}
|
&header;
&title;
&bodytop("ペットデータ($num代目)");
&petdata;
srand(time);
$rnd = int(rand(100) + 1); # Amend Ver 2.2
$fa = $FORM{'mode'};
$water = $FORM{'key'};
&init_cipher;
$plustxt = &cipher($FORM{'good'});
$minustxt = &cipher($FORM{'bad'});
if ($fa eq 'play') { $lastplay = time }
if ($fa eq 'out') { $out = 1; $outdate = time }
if ($rnd <= $rnd_border) {
&petnow($rnd_img,$rnd_msg);
$love--;
}
# elsif ($FORM{'good'} =~ /$fa/) {
elsif ($plustxt =~ /$fa/) {
&petnow($good_img{$fa},$good_msg{$fa});
$love++;$good++;
if ($fa eq "feed") { $lastfeed = time }
}
# elsif ($FORM{'bad'} =~ /$fa/) {
elsif ($minustxt =~ /$fa/) {
&petnow($bad_img{$fa},$bad_msg{$fa});
$love--;$bad++;
}
else {
&petnow($else_img{$fa},$else_msg{$fa});
}
&openoutpetdata;
|
# ------------------------- #
# Sub Get Time
# 時間の取得
# ------------------------- #
sub gettime {
($sec,$min,$hour,$dy,$mon,$year,$wday,$yday,$isdst) = localtime($_[0]);
$year += 1900 ;
$mon = $mon + 1;
@week = ('日','月','火','水','木','金','土');
$date = "$year年$mon月$dy日\($week[$wday]\)";
}
# ------------------------- #
# 暗号表作成サブ
# 使い方:init_cipher;
# 暗号化・解読サブの為に一度だけ実行
# ------------------------- #
sub init_cipher{
# 乱数初期化(種が一致すれば同じ乱数列が得られる)
srand($salt + $water);
# 暗号表作成
@cipher_list = sort {rand(1) <=> rand(1)} ('A'..'Z','_','a'..'z');
}
# ------------------------- #
# 暗号化・解読サブ
# 使い方: $x = &cipher(文字列);
# 引数の文字列を暗号化/解読
# init_cipherで一度暗号表を作っておく必要有
# ------------------------- #
sub cipher{
# 引数読み込み
$work = shift;
# 暗号の対応テーブルを作成
# @cipher_listがABCDEFとした場合,
# list1 : ABCDEF
# list2 : FEDBCA
# となって,
# A→F , F→Aとペアになって対応するので
# 暗号化・解読のどちらにでも使える。
$list1 = join "",@cipher_list;
$list2 = join "",reverse @cipher_list;
eval '$work =~ '."tr/$list1/$list2/;";
return $work;
};
|
print "<tr>\n";
print "<td colspan=\"2\">\n";
print "<div align=\"right\">\n";
&input('hidden','name',$FORM{'name'},'','');
&input('hidden','pass',$FORM{'pass'},'','');
# &input('hidden','good',"$scheduledsr[$timeafter]$plusfeed",'','');
# &input('hidden','bad',"$schedulednt[$timeafter]$minusfeed",'','');
$water=time;
&init_cipher;
if ($feedflg == 0) {
# &input('hidden','good',"$scheduledsr[$timeafter]",'','');
# &input('hidden','bad',"$schedulednt[$timeafter]",'','');
$plustxt = &cipher("$scheduledsr[$timeafter]");
$minustxt = &cipher("$schedulednt[$timeafter]");
}
else {
# &input('hidden','good',"$plusfeed",'','');
# &input('hidden','bad',"$minusfeed",'','');
$plustxt = &cipher("$plusfeed");
$minustxt = &cipher("$minusfeed");
}
&input('hidden','key',"$water",'','');
&input('hidden','good',"$plustxt",'','');
&input('hidden','bad',"$minustxt",'','');
&input('submit','','OK!','','<br>');
print "</div>\n";
&tablebottom;
} else { $actionflag = 1; }
|