📄 regist.pl
字号:
#----------------#
# 书き??み处理 #
#----------------#
sub regist {
# ファイルロック
if ($lockkey == 1) { &lock1; }
elsif ($lockkey == 2) { &lock2; }
&set_cookie;
&get_host;
$date = time();
if($in{'new'} ne 'new'){
open(IN,"./charalog/$in{'id'}.cgi") or &error('ファイルを开けませんでした。');
@regist = <IN>;
close(IN);
}else{
open(IN,"./charalog/$in{'id'}.cgi");
@regist = <IN>;
close(IN);
}
$hit=0;@new=();
foreach(@regist){
($cid,$cpass,$csite,$curl,$cname,$csex,$cchara,$cn_0,$cn_1,$cn_2,$cn_3,$cn_4,$cn_5,$cn_6,$csyoku,$chp,$cmaxhp,$cex,$clv,$cgold,$clp,$ctotal,$ckati,$cwaza,$citem,$cmons,$chost,$cdate,$cmori,$cdef,$ctac,$ckumite) = split(/<>/);
if($cid eq "$in{'id'}" and $in{'new'} eq 'new') {
&error("そのIDはすでに登录されています");
}elsif($curl eq "$in{'url'}" and $in{'new'} eq 'new'){
&error("そのURLはすでに登录されています");
}elsif($cid eq "$kid"){
unshift(@new,"$kid<>$kpass<>$ksite<>$kurl<>$kname<>$ksex<>$kchara<>$kn_0<>$kn_1<>$kn_2<>$kn_3<>$kn_4<>$kn_5<>$kn_6<>$ksyoku<>$khp<>$kmaxhp<>$kex<>$klv<>$kgold<>$klp<>$ktotal<>$kkati<>$kwaza<>$kitem<>$kmons<>$host<>$date<>$kmori<>$kdef<>$ktac<>$kkumite<>\n");
$hit=1;
}else{
if(($date - $cdate) > (60 * 60 * 24 * $limit)) { next; }
push(@new,"$_");
}
}
if(!$hit and $in{'new'} eq 'new'){
if($ENV{'HTTP_REFERER'} ne "$scripto_url"){ &error("不正キャラは作れません"); }
$lp=int(rand(15));
$hp = int(($in{'n_3'} + $kiso_nouryoku[3]) + (rand($lp) + 1)) + $kiso_hp;
$ex=0;
$lv=1;
$gold=0;
$n_0 = $kiso_nouryoku[0] + $in{'n_0'};
$n_1 = $kiso_nouryoku[1] + $in{'n_1'};
$n_2 = $kiso_nouryoku[2] + $in{'n_2'};
$n_3 = $kiso_nouryoku[3] + $in{'n_3'};
$n_4 = $kiso_nouryoku[4] + $in{'n_4'};
$n_5 = $kiso_nouryoku[5] + $in{'n_5'};
$n_6 = $kiso_nouryoku[6] + $in{'n_6'};
$c_syoku = $in{'syoku'};
unshift(@new,"$in{'id'}<>$in{'pass'}<>$in{'site'}<>$in{'url'}<>$in{'c_name'}<>$in{'sex'}<>$in{'chara'}<>$n_0<>$n_1<>$n_2<>$n_3<>$n_4<>$n_5<>$n_6<>$c_syoku<>$hp<>$hp<>$ex<>$lv<>$gold<>$lp<>$total<>$kati<>$waza<>$item<>$mons<>$host<>$date<>$mori<>$def<>$tac<>$kumite<>\n");
}
open(OUT,">./charalog/$in{'id'}.cgi") or &error('ファイルを开けませんでした。');
print OUT @new;
close(OUT);
# ロック解除
if (-e $lockfile) { unlink($lockfile); }
if($in{'new'}) { &make_end; }
}
#----------------#
# デコ—ド处理 #
#----------------#
sub decode {
if ($ENV{'REQUEST_METHOD'} eq "POST") {
if ($ENV{'CONTENT_LENGTH'} > 51200) { &error("投稿量が大きすぎます"); }
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
} else { $buffer = $ENV{'QUERY_STRING'}; }
@pairs = split(/&/, $buffer);
foreach (@pairs) {
($name,$value) = split(/=/, $_);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# 文字コ—ドをシフトJIS变换
&jcode'convert(*value, "sjis", "", "z");
# タグ处理
$value =~ s/</</g;
$value =~ s/>/>/g;
$value =~ s/\"/"/g;
# 改行等处理
$value =~ s/\r//g;
$value =~ s/\n//g;
# 一括削除用
if ($name eq 'del') { push(@DEL,$value); }
$in{$name} = $value;
}
$mode = $in{'mode'};
$in{'url'} =~ s/^http\:\/\///;
$cookie_pass = $in{'pass'};
$cookie_id = $in{'id'};
}
#----------------#
# ホスト名取得 #
#----------------#
sub get_host {
$host = $ENV{'REMOTE_HOST'};
$addr = $ENV{'REMOTE_ADDR'};
if ($get_remotehost) {
if ($host eq "" || $host eq "$addr") {
$host = gethostbyaddr(pack("C4", split(/\./, $addr)), 2);
}
}
if ($host eq "") { $host = $addr; }
}
#--------------#
# エラ—处理 #
#--------------#
sub error {
&header;
if (-e $lockfile) { unlink($lockfile); }
if (-e $cntlock) { unlink($cntlock); }
print "<center><hr width=400><h3>ERROR !</h3>\n";
print "<P><font color=red><B>$_[0]</B></font>\n";
print "<P><hr width=400></center>\n";
print "</body></html>\n";
exit;
}
#--------------#
# クラス设定 #
#--------------#
sub class {
if($chara_flag){
if($klv > 149) {$class = "<i><b>MASTER</b></i>";
}elsif($klv < 20){$class = "★☆☆☆☆☆";
}elsif($klv < 40){$class = "★★☆☆☆☆";
}elsif($klv < 60){$class = "★★★☆☆☆";
}elsif($klv < 80){$class = "★★★★☆☆";
}elsif($klv < 100){$class = "★★★★★☆";
}elsif($klv < 150){$class = "★★★★★★";
}
}else{
if($wlv > 149) {$class = "<i><b>MASTER</b></i>";
}elsif($wlv < 20){$class = "★☆☆☆☆☆";
}elsif($wlv < 40){$class = "★★☆☆☆☆";
}elsif($wlv < 60){$class = "★★★☆☆☆";
}elsif($wlv < 80){$class = "★★★★☆☆";
}elsif($wlv < 100){$class = "★★★★★☆";
}elsif($wlv < 150){$class = "★★★★★★";
}
}
}
#-------------------------------#
# ロックファイル:symlink关数 #
#-------------------------------#
sub lock1 {
local($retry) = 5;
while (!symlink(".", $lockfile)) {
if (--$retry <= 0) { &error("LOCK is BUSY"); }
sleep(1);
}
}
#----------------------------#
# ロックファイル:open关数 #
#----------------------------#
sub lock2 {
local($retry) = 0;
foreach (1 .. 5) {
if (-e $lockfile) { sleep(1); }
else {
open(LOCK,">$lockfile") || &error("Can't Lock");
close(LOCK);
$retry = 1;
last;
}
}
if (!$retry) { &error("しばらくお待ちになってください(^^;)"); }
}
#------------------#
# クッキ—の发行 #
#------------------#
sub set_cookie {
# クッキ—は60日间有效
local($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime(time+60*24*60*60);
@month=('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$gmt = sprintf("%s, %02d-%s-%04d %02d:%02d:%02d GMT",
$week[$wday],$mday,$month[$mon],$year+1900,$hour,$min,$sec);
$cook="id<>$cookie_id\,pass<>$cookie_pass";
print "Set-Cookie: FFADV=$cook; expires=$gmt\n";
}
1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -