########################################## # CC-SEARCH VT.2.13 # CC-ROOM - http://cc-room.net/ # since - 2008/07/10 (VT - 2009/05/03) # update - 2011/09/04 ########################################## use CGI::Carp qw(fatalsToBrowser); require './pl/cc_cnf.pl'; require './pl/cc_mail.pl'; require './pl/cc_make.pl'; require './pl/category.pl'; require $jcode; if($lwp && !$notlwp){ eval 'use LWP::UserAgent;'; $ua = eval'LWP::UserAgent->new'; eval '$ua->agent(undef)'; eval '$ua->timeout(10)'; } srand; ®ist; #データ受け取り &dcode; $act = $F{'a'}; if($forbit == 1){ &error("外部からのアクセスは出来ません。") if $ENV{'HTTP_REFERER'} !~ /$scriptdir/i && $act ne 'help' && $act ne 'check'; } $fe = 0; if($F{'f'} == 1){ $fm = qq'\n'; $fe = 1; } $nftype= 0; eval{ &navibar } if !$fe; $name = $F{'name'}; $email = $F{'email'}; $pass = $F{'pass'}; $pass2 = $F{'pass2'}; $sitename = $F{'sitename'}; $siteurl = $F{'siteurl'}; @sitebanner = split(" ",$F{'sitebanner'}); $sitecomment = $F{'sitecomment'}; $sitekeyword = $F{'sitekeyword'}; $siteadmincomment = $F{'siteadmincomment'}; for(my $i=0;$i<=$#reqcate;$i++){ if($F{"sitecat$i"}){ push(@rsitecat,$F{"sitecat$i"}); } } @sitecat = split(" ",$F{'sitecat'}); $siteerr = $F{'siteerr'}; $rent = $F{'rent'}; @sitemark = split(" ",$F{'sitemark'}); if(@marks > 10){ $sitemark = join('_',@sitemark); $sm = 1; } else{ $sitemark = join('',@sitemark); $sm = 0; } $sogourl = $F{'sogourl'}; $id = $F{'id'}; $url = $F{'url'}; $up = $F{'up'}; $cpass = $F{'cpass'}; $ra = $F{'ra'}; $cid = $F{'cid'}; @notice = split(" ",$F{'notice'}); $com = $F{'com'}; $norgbnr = $F{'norgbnr'}; $catp = $F{'catp'}; if(@PL){ $p[$_] = $F{'p'.$PL[$_][0]} foreach(0..$#PL); } undef(@sitebanner) if index($sitebanner[0],"http://") == -1; $checkpass = $ra && $apasscrypt?crypt($cpass,$adminpass):$cpass; if($act eq "ask"){ &error("不正なアクセスです。",0,$fe) if $getfl; if($regask){ ®ask; }else{ ®ist1; } } elsif($act eq "remode"){ &error("不正なアクセスです。",0,$fe) if($regask && !$F{'rack'}); ®ist1; } elsif($act eq "regist2"){ ®ist2; } elsif($act eq "regist3"){ ®ist3; } elsif($act eq "check"){ ✓ } elsif($act eq "update"){ &update; } elsif($act eq "edit1"){ &edit1; } elsif($act eq "edit2"){ &edit2; } elsif($act eq "edit3"){ &error("不正なアクセスです。",0,$fe) if $getfl; &edit3; } elsif($act eq "del"){ &del; } elsif($act eq "repass"){ &repass; } elsif($act eq "repass1"){ &repass1; } elsif($act eq "nt"){ ¬ice; } elsif($act eq "notice1"){ ¬ice1; } elsif($act eq "help"){ &help; } elsif($act eq "ctex"){ &catexp; } else{ &enter; } exit; #注意事項 sub enter{ print "Content-type:text/html; charset=utf-8\n\n"; require $template.'regist_top.html'; } #使い方 sub help{ print "Content-type:text/html; charset=utf-8\n\n"; require $template.'cc_help.html'; } #カテゴリ詳細 sub catexp{ print "Content-type:text/html; charset=utf-8\n\n"; require $template.'catexp.html'; } #入力データチェック sub datacheck{ if($pass eq ""){ &error("PASSを設定してください。",0,$fe); } elsif($pass2 eq "" && $act eq "regist2"){ &error("確認用のPASSを入力してください。",0,$fe); } my $com = $sitecomment; &error("選択必須カテゴリが選択されていません。",0,$fe) if $#rsitecat != $#reqcate; my $a1 = @reqcate2; my($a2,@a1); my $i = 0; foreach(@reqcate2){ foreach $a2(@sitecat){ $a1[$i] = 1 if $a2 =~ /^$_/; } $i++ if $a1[$i]; } &error("選択必須カテゴリが選択されていません。",0,$fe) if $a1 != @a1; @sitecat0 = @sitecat; unshift(@sitecat,@rsitecat); if($slcnt[0][0]){ foreach(0 .. $#slcnt){ $i = 0; foreach $a1(@sitecat){ $i++ if index($a1,$slcnt[$_][0]) == 0; &error("カテゴリ[".$category{$slcnt[$_][0]}."]の選択上限数(".$slcnt[$_][1]."個)を越えています。",0,$fe) if $i > $slcnt[$_][1]; } } } if($commentbr == 1){ $com =~ s/
//g; } if($name eq "" && $reqitem[0]){ &error("名前を入力してください。",0,$fe); } elsif($email eq "" && ($reqitem[1] || $mailcheck[0][0] || $mailcheck[1][0])){ &error("E-Mailを入力してください。",0,$fe);} elsif($sitename eq "" && $reqitem[2]){ &error("サイト名を入力してください。",0,$fe); } elsif($siteurl eq "" && $reqitem[3]){ &error("サイトURLを入力してください。",0,$fe); } elsif($sitecat[0] eq "" && !@reqcate && $reqitem[4]){ &error("カテゴリを選択してください。",0,$fe); } elsif($sitecomment eq "" && $reqitem[5]){ &error("コメントを入力してください。",0,$fe); } elsif($sitekeyword eq "" && $reqitem[6]){ &error("キーワードを入力してください。",0,$fe); } elsif($siteadmincomment eq "" && $reqitem[7] && $act eq "regist2"){ &error("管理人へのコメントを入力してください。",0,$fe); } elsif(length($name) > $maxname){ &error("お名前は半角$maxname字以内に収めてください。",0,$fe); } elsif(length($email) > $maxemail){ &error("メールアドレスは半角$maxemail字以内に収めてください。",0,$fe); } elsif((length($pass) < 3) || (length($pass) > 8)){ &error("PASSは半角英数字3~8文字に収めてください。",0,$fe); } elsif(length($sitename) > $maxsitename){ &error("サイト名は半角$maxsitename字以内に収めてください。",0,$fe); } elsif(length($siteurl) > $maxsiteurl){ &error("サイトURLは半角$maxsiteurl字以内に収めてください。",0,$fe); } elsif(length($sitebanner) > $maxsitebnr){ &error("バナーURLは半角$maxsitebnr字以内に収めてください。",0,$fe); } elsif(length($com) > $maxsitecom){ &error("コメントは全角".(int($maxsitecom / 2))."字以内に収めてください。",0,$fe); } elsif(length($sitekeyword) > $maxsitekw){ &error("キーワードは全角".(int($maxsitekw / 2))."字以内に収めてください。",0,$fe); } elsif(length($siteadmincomment) > $maxsiteacom){ &error("管理人へのコメントは全角".(int($maxsiteacom / 2))."字以内に収めてください。",0,$fe); } elsif(!$ra && length($F{'ames'}) > $maxsiteacom){ &error("管理人へのコメントは全角".(int($maxsiteacom / 2))."字以内に収めてください。",0,$fe); } elsif($pass =~ /[^0-9a-zA-Z]/){ &error("PASSは半角英数字のみで設定してください。",0,$fe); } elsif($sitecat[$maxcat] ne ""){ &error("カテゴリは$maxcat個までしか選択できません。",0,$fe); } elsif($email && $email !~ /[\w\.\-\&]+\@[\w\.\-\&]+\.[\w\.\-\&]/){ &error("メールアドレスが間違っています。",0,$fe); } elsif($siteurl){ if($lwp && !$notlwp){ my $res = eval'$ua->request(HTTP::Request->new(GET => $siteurl))'; # &error("サイトURL先にファイルが存在しないか、繋がらない状態です。",0,$fe) unless eval'$res->is_success'; my $cksm; if($sogocheck && $sogomark ne 'all'){ foreach my $cm(@sitemark){ if($cm eq $sogomark){ $cksm = 1; last; } } } if($sogocheck && ($sogomark eq 'all' || $cksm)){ undef $sogourl if $siteurl eq $sogourl; if($sogourl){ $siteurl =~ /^(http:\/\/[^\/]+\/)/; &error("サイトURLとリンクページURLのドメインが一致しません。",0,$fe) if $sogourl !~ /^$1/ && !$F{'sogodmck'}; $res = eval'$ua->request(HTTP::Request->new(GET => $sogourl))'; } my $ckurl = eval'$res->content'; if($ckurl !~ / $PL[$_][2] * 2; } } foreach(@denyurl){ &error("このURLは登録できません。",0,$fe) if $siteurl =~ /$_/i; } foreach(@denyword){ if(index($sitecomment,$_) != -1){ &error("このコメントは登録できません。",0,$fe); } if(index($sitekeyword,$_) != -1){ &error("このキーワードは登録できません。",0,$fe); } } &banner_check if @sitebanner; if($commentbr == 1){ if($maxscline){ @a1 = split("
",$sitecomment); &error("コメントは".$maxscline."行以内に収めてください。",0,$fe) if @a1 > $maxscline; } while(1){ last if $sitecomment !~ /


/; $sitecomment =~ s/


/

/g; } } } #URLチェック sub urlcheck{ my $a1 = shift; my $a2; if($a1 eq "logdata"){ $a2 = $logdata; }else{ $a2 = 'regreq.cgi'; } &lock($a1); open(IN,$datadir.$a2); while(){ if(index($_,">$siteurl<") != -1 && $siteurl ne ""){ if((split('',(split("<>"))[8]))[0] eq $siteurl){ close(IN); &unlock($a1); if($a1 eq "logdata"){ &error("このURLは既に登録されています。",0,$fe); } else{ &error("このURLは登録申\請中です。",0,$fe); } } } } close(IN); &unlock($a1); } sub banner_check{ if(index($sitebanner[0],$bnurl) == 0){ my $ckbnr = $sitebanner[0]; $ckbnr =~ s/.+\///; # &error("バナーファイルが存在しません。",0,$fe) unless -f $bndir.$ckbnr; }elsif($lwp && !$notlwp){ my $res = eval'$ua->request(HTTP::Request->new(GET => $sitebanner[0]))'; # &error("バナーファイルが存在しません。",0,$fe) unless eval'$res->is_success'; my $a1 = length(eval'$res->content'); $bfsize = ((int($a1 / 102.4)) / 10).'kb'; &error("バナーのファイルサイズは".$maxbfsize."kbまでです($bfsize)。",0,$fe) if $a1 && $maxbfsize && $a1 > $maxbfsize * 1024; } if($denybnr){ require './pl/denybnr.pl'; foreach(@denybnr){ &error("バナーURLが画像の外部呼出し禁止サーバのものです。",0,$fe) if $sitebanner[0] =~ /$_/i; } foreach(@banner){ if($sitebanner[0] =~ /$_/i){ &error("ご使用のサーバはbanner.拡張子のバナーのみ利用可能\です。",0,$fe) if index($sitebanner[0],'banner.') == -1; } } } if(!$sitebanner[1] || !$sitebanner[2]){ &error("バナーサイズを入力してください。",0,$fe); } if($sitebanner[1] > $maxbnrsize[0] || $sitebanner[2] > $maxbnrsize[1]){ &error("バナーサイズが大きすぎます。",0,$fe); } } #PASS再発行 sub repass{ if(!$ra){ &error("メールアドレスを入力してください。",0,$fe) if $email eq ""; &error("メールアドレスが間違っています。",0,$fe) if $email !~ /[\w\.\-\&]+\@[\w\.\-\&]+\.[\w\.\-\&]/; } my(@site,@log,$name,$sitename,$siteurl,$newpass,$cryptpass,$buf); my $flag = 0; my $a1 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./"; my $a2 = substr($a1,int(rand(64)),1).substr($a1,int(rand(64)),1); for(0 .. 7){ $newpass .= substr($a1,int(rand(62)),1); } $cryptpass = crypt($newpass,$a2); &lock("logdata"); &error("データが開けませんでした。","logdata",$fe) unless open(IO,'+<'.$datadir.$logdata); eval{ flock(IO,2) }; while(){ if(index($_,"$cid<") == 0){ @log = split("<>"); if(($log[0] eq $cid) && ((($checkpass eq $adminpass) && ($ra == 1)) || (($log[11] eq $email) && (!$ra)))){ ($name,$email,$sitename,$siteurl) = ($log[6],$log[11],$log[4],(split('',$log[8]))[0]); $log[12] = $cryptpass; push(@site,join("<>",@log)); $flag = 1; }else{ push(@site,$_); } }else{ push(@site,$_); } } if($flag){ truncate(IO,0); seek(IO,0,0); print IO @site; } close(IO); &unlock("logdata"); if(!$flag){ if($ra == 1){ &error("PASSが間違っています。",0,$fe); } else{ &error("メールアドレスが登録時のものと違います。
\n[通知]から管理人にPASSの再発行を申\し出てください。",0,$fe); } } &repass_mail($name,$sitename,$siteurl,$newpass,$email,$cid) if $mailcheck[4][0]; $action = "PASS再発行"; $showform = <
EOD if($mailcheck[4][0] && !$ra){ $showform .= < EOD }else{ $showform .= <$sitenameの新しいPASSは $newpass です。

EOD } &show_html; } sub repass1{ &error("メールアドレスを入力してください。",0,$fe) if $email eq ""; &error("メールアドレスが間違っています。",0,$fe) if $email !~ /[\w\.\-\&]+\@[\w\.\-\&]+\.[\w\.\-\&]/; my $flag = 0; my $sname; &lock("logdata"); open(IN,$datadir.$logdata); while(){ if(index($_,"$cid<") == 0){ my($id,$a1,$cml) = (split("<>"))[0,4,11]; if($cid eq $id && $email eq $cml){ $flag = 1; $sname = $a1; last;} } } close (IN); &unlock("logdata"); if(!$flag){ &error("メールアドレスが登録時のものと違います。
\n[通知]から管理人にPASSの再発行を申\し出てください。",0,$fe); }else{ &lock("noticedata"); &error("データが開けませんでした。","noticedata",$fe) unless open(OUT,">>".$datadir."notice.cgi"); eval{ flock(OUT,2) }; print OUT $cid."<>6<><>".$ENV{'REMOTE_ADDR'}."<>\n"; close (OUT); &unlock("noticedata"); ¬ice_mail($sname,"PASS再発行申\請","",$cid) if $mailcheck[4][0]; $action = "PASS再発行申\請完了"; $showform = <PASS再発行の申\請を行いました。 EOD &show_html; } } #削除 sub del{ &error("削除用のチェックが入っていません。",0,$fe) if $F{'dck'} ne 'on'; my(@site,@log,$name,$email,$sitename,$siteurl,$drs0); $drs0 = $F{'drs'}; my $flag = 0; &backup; &lock("logdata"); &error("データが開けませんでした。","logdata",$fe) unless open(IO,'+<'.$datadir.$logdata); eval{ flock(IO,2) }; while(){ if(index($_,"$cid<") == 0){ @log = split("<>"); my $upass = $log[12]; if($log[0] eq $cid && ((crypt($cpass,$upass) eq $upass && $ra == 0) || ($checkpass eq $adminpass && $ra == 1))){ ($name,$sitename,$siteurl,$email,$drs)=($log[6],$log[4],(split('',$log[8]))[0],$log[11],$drs0); $flag = 1; }else{ push(@site,$_); } }else{ push(@site,$_); } } if($flag){ truncate(IO,0); seek(IO,0,0); print IO @site; } close (IO); &unlock("logdata"); &error("PASSが間違っています。",0,$fe) unless $flag; &mk_index(@site); if($drs0){ &lock("admes"); open(IO,"+<".$datadir."admes.cgi"); eval{ flock(IO,2) }; my @log = ; unshift(@log,time."<>$name<>$email<>$sitename<>$siteurl<>
※このサイトは削除されました
[削除理由] $drs<><>\n"); pop(@log) if $#log >= $maxtoadmin; truncate(IO,0); seek(IO,0,0); print IO @log; close(IO); &unlock("admes"); } if($bnupload && $log[9] =~ /^$bnurl/){ foreach('.jpg','.gif','.png'){ unlink($bndir.$cid.$_); } } if($advmode){ undef(@site); $flag = 0; &lock("updata"); open(IO,'+<'.$datadir."up.cgi"); eval{ flock(IO,2) }; while(){ if((split("<>"))[0] ne $cid){ push(@site,$_); }else{ $flag = 1; } } if($flag){ truncate(IO,0); seek(IO,0,0); print IO @site; } close(IO); &unlock("updata"); } undef(@site); $flag = 0; &lock("noticedata"); open(IO,'+<'.$datadir."notice.cgi"); eval{ flock(IO,2) }; while(){ if((split("<>"))[0] ne $cid){ push(@site,$_); }else{ $flag = 1; } } if($flag){ truncate(IO,0); seek(IO,0,0); print IO @site; } close(IO); &unlock("noticedata"); if($accessrank){ undef(@site); $flag = 0; &lock("cntdata"); open(IO,'+<'.$datadir."count.cgi"); eval{ flock(IO,2) }; while(){ if((split("<>"))[1] ne $cid){ push(@site,$_); }else{ $flag = 1; } } if($flag){ truncate(IO,0); seek(IO,0,0); print IO @site; } close(IO); &unlock("cntdata"); } local $time = time; local $thisdate = &make_date; &del_mail($name,$sitename,$siteurl,$email,$drs,$F{'ames'}) if($ra == 0 && $mailcheck[3][0]) || ($F{'mlck'} && $F{'ames'}); $action = "削除完了"; $showform = <
ご利用ありがとうございました。

EOD &show_html; } #宣伝 sub update{ $maxupdate = $maxupdatep if $F{'ckp'} && $maxupdatep; if($sitecomment eq ""){ &error("宣伝を入力してください。",0,$fe); } elsif(length($sitecomment) > $maxupdate){ &error("宣伝は全角".(int($maxupdate / 2))."字以内に収めてください。",0,$fe); } elsif(length($sitebanner[0]) > $maxsitebnr){ &error("バナーURLは半角$maxsitebnr字以内に収めてください。",0,$fe); } elsif(($sitebanner[0] ne "") && ($sitebanner[0] !~ /^https?:\/\/[\w|\:\@\-]+\.[\w|\:\!\#\%\=\&\-\|\@\~\+\.\?\/]+$/)){ &error("バナーURLが間違っています。",0,$fe); } &banner_check if @sitebanner; foreach(@updenyword){ &error("宣伝できない内容が含まれています。",0,$fe) if index($sitecomment,$_) != -1; } if($commentbr == 1){ if($maxudline){ @a1 = split("
",$sitecomment); &error("宣伝は".$maxudline."行以内に収めてください。",0,$fe) if @a1 > $maxudline; } while(1){ last if $sitecomment !~ /


|
$/; $sitecomment =~ s/


/

/g; $sitecomment =~ s/
$//; } } my($id,$a1,$a2,@l,@site,$sitebanner); my $flag = 0; my $time = time(); if($F{'ckp'}){ $a2 = $time - 86400 * $advtimep; } else{ $a2 = $time - 86400 * $advtime; } my $a3 = $time - 86400 * $advdate; my $cat = $F{'c'}; $cat =~ s/<//g; if($sitebanner[0] eq "http://" || $bannerreg == 0){ $sitebanner = ""; } else{ $sitebanner = join("",@sitebanner); } open(IN,$datadir.$searchlog); while(){ if(index($_,$cid.'<>') == 0){ @l = split('<>'); last; } } close(IN); $sitename = $l[4]; $l[5] = $sitecomment; $l[9] = $sitebanner; $l[10] = $siteadmincomment; &lock("updata"); &error("データが開けませんでした。","updata",$fe) unless open(IO,'+<'.$datadir."up.cgi"); eval{ flock(IO,2) }; while(){ ($id,$l[3]) = (split("<>"))[0,3]; $a1 = (split("_",$l[3]))[0]; last if $a1 <= $a3; if($id eq $cid){ if($a1 > $a2){ $flag = 1; push(@site,join('<>',@l)); } }else{ push(@site,$_); } } if(!$flag){ if($F{ckt}){ $l[3] = $time."_1"; }else{ $l[3] = $time."_0"; } unshift(@site,join('<>',@l)); } truncate(IO,0); seek(IO,0,0); print IO @site; close (IO); &unlock("updata"); &rssdata($time) if !$flag && $rssmode; $action = "宣伝登録・変更完了"; $showform = $advname."情報の登録・変更を完了しました。"; &show_html; } #変更 sub edit3{ &error("$cpass不正なアクセスです。",0,$fe) if (crypt($pass,$cpass) ne $cpass && $ra == 0) || (($apasscrypt?crypt($pass,$adminpass):$pass) ne $adminpass && $ra == 1); &mk_index; $action = 'データ反映完了'; $showform = <
ご利用ありがとうございました。

EOD &show_html; } sub edit2{ my(@site,$cat2,$rfl,@l,@time,@plog,$editlog); local(@log,$category); $siteurl = "" if $siteurl eq "http://"; $sogourl = "" if $sogourl eq "http://"; if($sitebanner[0] eq "http://" || $bannerreg == 0){ $sitebanner = ""; } elsif($norgbnr){ $sitebanner = "nb"; } else{ $sitebanner = join("",@sitebanner); } $pass = "admintmp" if $ra; if($F{'ckp'}){ $maxcat = $maxcatp if $maxcatp; $maxsitecom = $maxsitecomp if $maxsitecomp; } &datacheck; my $a1 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./"; my $a2 = substr($a1,int(rand(64)),1).substr($a1,int(rand(64)),1); local $cryptpass = crypt($pass,$a2); $category = join("",@sitecat); foreach(@sitecat){ $cat2 .= " " if $_ ne $sitecat[0]; $cat2 .= &linkmake($_,0)."\n"; } chomp($cat2); &urlcheck("regreq") if $durlcmode; open(IN,$datadir.$logdata); my @data = ; close(IN); local $flag = 0; local $time = time(); local $thisdate = &make_date; foreach(@data){ if(index($_,$cid."<") == 0){ @log = split("<>"); my $upass = $log[12]; if($log[0] eq $cid && ((crypt($cpass,$upass) eq $upass && !$ra) || ($checkpass eq $adminpass && $ra))){ if($ra){ $cryptpass = $upass; $sitemark .= ($sm && $sitemark?'_':'').$rent if $rent; }else{ $cryptpass = $upass if $cpass eq $pass; @time = split('_',$log[3]); if($time - $time[2] < 60 * $edittime){ $flag = 'notedit'; $a1 = $time[2] + 60 * $edittime; last; } $sitemark = $log[2] unless $remark; $sitemark = $` if rindex($sitemark,'x') != -1 && $sitemark =~ /x|_x/; $sitemark .= ($sm && $sitemark?'_':'').$rent if $rent; $siteerr = $log[13]; $siteadmincomment = $log[10]; } if($regmode == 2 && !$ra){ $cryptpass = $pass; $siterenewtime = $time[0].'_'.$time[1].'_'.$time; $siterenewtime .= '_1' if $up; $siteadmincomment = $F{'ames'}.($F{'ames'} && $catp?'
':'').($catp?qq'■追加希望カテゴリ => $catp':'').''.$log[10]; }else{ if($up){ $siterenewtime = $time."_1_".$time; } elsif($ra){ $siterenewtime = $log[3]; } else{ $siterenewtime = $time[0].'_'.$time[1].'_'.$time; } } $id = $log[0]; $siteerr = 0 if $siteerr eq ""; my @rglog = ($id,$category,$sitemark,$siterenewtime,$sitename,$sitecomment,$name,$sitekeyword,$siteurl.($sogourl?''.$sogourl:''),$sitebanner,$siteadmincomment,$email,$cryptpass,$siteerr); push(@rglog,@p) if @PL; foreach my $i(0..$#imgsize){ $rglog[$imgsize[$i][0]] = $F{'f'.$imgsize[$i][0]}?$F{'f'.$imgsize[$i][0]}:'' if $F{'f'.$imgsize[$i][0]} ne ""; } $editlog = join('<>',@rglog,"\n"); $flag = 1; last; } }elsif(index($_,">$siteurl<") != -1 && $durlcmode){ if((split('',(split('<>'))[8]))[0] eq $siteurl){ close(IN); &error("このURLは既に登録されています。",0,$fe); } } } &error("PASSが間違っています。",0,$fe) unless $flag; if($flag == 1){ &backup; if($regmode == 2 && !$ra){ &lock("editreq"); &error("データが開けませんでした。","editreq",$fe) unless open(IO,'+<',$datadir.'editreq.cgi'); eval{ flock(IO,2) }; while(){ if(index($_,$cid."<") == 0){ if($cid eq (split('<>'))[0]){ push(@site,$editlog); $flag = 2; } else{ push(@site,$_); } }else{ push(@site,$_); } } truncate(IO,0); seek(IO,0,0); print IO @site; print IO $editlog if $flag != 2; close(IO); &unlock("editreq"); }else{ &lock("logdata"); &error("データが開けませんでした。","logdata",$fe) unless open(IO,'+<',$datadir.$logdata); eval{ flock(IO,2) }; while(){ if(index($_,$cid."<") == 0){ if($cid eq (split('<>'))[0]){ if($up){ unshift(@site,$editlog); $rfl = 1; }else{ push(@site,$editlog); } $flag = 2; }else{ push(@site,$_); } }else{ push(@site,$_); } } if($flag == 2){ truncate(IO,0); seek(IO,0,0); print IO @site; } close(IO); &unlock("logdata"); if($rent && $F{'reck'}){ my(@cnt,$cfl); &lock("cntdata"); open(IO,'+<'.$datadir."count.cgi"); eval{ flock(IO,2) }; while(){ if($id eq (split('<>'))[1]){ $cfl = 1; }else{ push(@cnt,$_); } } if($cfl){ truncate(IO,0); seek(IO,0,0); print IO @cnt; } close(IO); &unlock("cntdata"); } if($advmode){ my($cfl,@site); $a1 = $time - 86400 * $advdate; &lock("updata"); open(IO,'+<'.$datadir."up.cgi"); eval{ flock(IO,2) }; while(){ my @l = split("<>"); if((split("_",$l[3]))[0] <= $a1){ $cfl = 1; last; } if($l[0] eq $cid){ $cfl = 1; next if $siteerr; my @up = ($cid,$category,$sitemark,$l[3],$sitename,$l[5],$name,$sitekeyword,$siteurl,$l[9],$siteadmincomment,"","",""); push(@up,@p) if @PL; push(@site,join("<>",@up,"\n")); }else{ push(@site,$_); } } if($cfl){ truncate(IO,0); seek(IO,0,0); print IO @site; } close(IO); &unlock("updata"); } } if(!$ra && ($F{'ames'} || $catp)){ my @amlog; &lock("admes"); open(IO,"+<".$datadir."admes.cgi"); eval{ flock(IO,2) }; @amlog = ; unshift(@amlog,$time."<>$name<>$email<>$sitename<>$siteurl<>[変更]
$F{'ames'}<>$catp<>\n"); pop(@amlog) if $#amlog >= $maxtoadmin; truncate(IO,0); seek(IO,0,0); print IO @amlog; close(IO); &unlock("admes"); } if(@PL){ foreach my $i(0..$#PL){ $p[$i] = $F{'f'.$PL[$i][0]} if $F{'f'.$PL[$i][0]}; $plog[$i] = $p[$i] if $PL[$i][4]; } } @sitebanner = () if $sitebanner eq "nb"; if(($regmode != 2 && $mailcheck[2][0] && $ra == 0) || ($F{'mlck'} && $F{'ames'})){ &edit_mail($name,$email,$pass,$sitename,$siteurl,$sitebanner[0],$sitebanner[1],$sitebanner[2],$cat2,$sitecomment,$sitekeyword,$id,$F{'ames'},$catp,@plog); } if($regmode == 2 && !$ra){ &preedit_mail($name,$email,$pass,$sitename,$siteurl,$sitebanner[0],$sitebanner[1],$sitebanner[2],$cat2,$sitecomment,$sitekeyword,$id,$F{'ames'},$catp,@plog) if $mailcheck[16][0]; local $endmes = $flag == 2?'変更申請内容の上書きを行いました。':'登録情報の変更申請が完了しました。'; $action = '登録情報申請完了'; print "Content-type:text/html; charset=utf-8\n\n"; require $template.'editreq_end.html'; exit; } &rssdata($time) if $rfl && $rssmode && !$ra; $action = "登録情報変更完了"; }else{ $action = qq'変更できません'; my @t = gmtime(32400 + $a1); $nexttime = sprintf("%02d月%02d日 %02d時%02d分%02d秒",($t[4]+1),$t[3],$t[2],$t[1],$t[0]); } print "Content-type:text/html; charset=utf-8\n\n"; require $template.'edit_end.html'; } #宣伝・変更・削除 sub edit1{ local(@site,@time,$bcom); my $flag = 0; &lock("logdata"); open(IN,$datadir.$logdata); while(){ if(index($_,"$cid<") == 0){ my @log = split("<>",$_); next if $log[0] ne $cid; if(!$ra){ my $upass = $log[12]; if(crypt($cpass,$upass) eq $upass){ $flag = 1; @site = @log; last; } } elsif($ra && $checkpass eq $adminpass){ $flag = 1; @site = @log; last; } } } close (IN); &unlock("logdata"); &error("PASSが違います。",0,$fe) unless $flag; local $time = time(); @time = split('_',$site[3]); if(($time - $time[2] < 60 * $edittime) && !$ra){ my @t = gmtime(32400 + $time[2] + 60 * $edittime); my $a1 = sprintf("%02d月%02d日 %02d時%02d分%02d秒",($t[4]+1),$t[3],$t[2],$t[1],$t[0]); &error("$a1 まで変更作業はできません。",'logdata',$fe); } if($regmode == 2){ my $reqfl; open(IN,$datadir.'editreq.cgi'); while(){ if(index($_,"$cid<>") == 0){ my @rlog = split('<>'); if($rlog[0] eq $cid){ @site = @rlog; $reqfl = 1; last; } } } close(IN); if($reqfl){ if($site[10]){ my $toames = (split('',$site[10]))[0]; ($toadminmes,$catp) = split('■追加希望カテゴリ => ',$toames); } if($toadminmes){ $toadminmes =~ s/
/\n/g; chomp($toadminmes); } $upcheck = ' checked' if (split('_',$site[3]))[3]; } } if($denybnr){ require './pl/denybnr.pl'; my $surl = (split('',$site[8]))[0]; foreach(@denybnr){ if(index($surl,$_) != -1){ $bcom = "\n ※ご使用のサーバは画像の外部呼び出し禁止になっています".($bnupload?'(アップロード機能をご利用ください)':'').'
'; last; } } unless($bcm){ foreach(@banner){ if(index($surl,$_) != -1){ $bcom = "\n ※ご使用のサーバは“banner.拡張子”以外の画像の外部呼び出しが禁止になっています
"; last; } } } } print "Content-type:text/html; charset=utf-8\n\n"; if($ra){ require $template.'cc_edit_admin.html'; } else{ require $template.'cc_edit.html'; } } #宣伝・変更・削除認証 sub check{ my($cid,$sname,$a1); &lock("logdata"); open(IN,$datadir.$logdata); while(){ if(index($_,"$id<") == 0){ ($cid,$sname) = (split("<>"))[0,4]; last if $cid eq $id; } } close (IN); &unlock("logdata"); &error("このIDは登録されていません。",0,$fe) if $cid eq ""; $a1 = "宣伝・" if $advmode; $showform = <$sname の$a1変更・削除を行います。

PASS



EOD if($repassmode && $mailcheck[4][0]){ $showform .= < 登録時のメールアドレスを記入してボタンを押してください。

E-Mail EOD }else{ $showform .= < 登録時のメールアドレスを記入して再発行の申\請を行ってください。

E-Mail EOD } $showform .= < $fm EOD $action = $a1."変更・削除"; &show_html; } #登録・登録申請 sub regist3{ &error("認証数字を入力してください。") unless $F{'ckno1'}; my($sitebanner,$cat,$cat2,@log,@plog); my $a1 = $F{'ckno2'}; for($i=0;$i<=9;$i++){ $a1 =~ s/$atno[$i]/$i/g; } &error("認証数字が一致しません。") if $a1 ne $F{'ckno1'}; $siteurl = "" if $siteurl eq "http://"; $sogourl = "" if $sogourl eq "http://"; if($sitebanner[0] eq "http://" || $bannerreg == 0){ $sitebanner = ""; } else{ $sitebanner = join("",@sitebanner); } &datacheck; $sitemark .= ($sm && $sitemark?'_':'').$rent if $rent; $cat = join("",@sitecat); foreach(@sitecat){ $cat2 .= " " if $_ ne $sitecat[0]; $cat2 .= &linkmake($_,0)."\n"; } chomp($cat2); local $time = time; local $thisdate = &make_date; &urlcheck("logdata") if $durlcmode; if($regmode){ #申請 if($durlcmode){ open(IN,$datadir."regreq.cgi"); while(){ if(index($_,">$siteurl<") != -1){ if((split('',(split('<>'))[8]))[0] eq $siteurl){ close(IN); &error("このURLは現在登録申\請中です。",0,$fe); } } } close(IN); } my $ames = $siteadmincomment.($siteadmincomment && $catp?'
':'').($catp?'■追加希望カテゴリ => '.$catp:''); my @new = ($time,$cat,$sitemark,$time."_0",$sitename,$sitecomment,$name,$sitekeyword,$siteurl.($sogourl?''.$sogourl:''),$sitebanner,$ames,$email,$pass,"0"); push(@new,@p) if @PL; my @newline = join("<>",@new,"\n"); &lock("regreq"); &error("データが開けませんでした。","regreq",$fe) unless open(IO,'+<'.$datadir."regreq.cgi"); eval{ flock(IO,2) }; my @site = ; truncate(IO,0); seek(IO,0,0); print IO @newline; print IO @site; close(IO); &unlock("regreq"); $action = '登録申請'; $showform = <
次回の更新時に申\請内容をチェックして、
問題が無かったら本登録となります。

ありがとうございました。

EOD }else{ #登録 &backup; my $a1="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./"; my $a2=substr($a1,int(rand(64)),1).substr($a1,int(rand(64)),1); my $cryptpass = crypt($pass,$a2); my @new = ($time,$cat,"",$time."_0",$sitename,$sitecomment,$name,$sitekeyword,$siteurl.($sogourl?''.$sogourl:''),$sitebanner,"",$email,$cryptpass,"0"); push(@new,@p) if @PL; my $newlog = join("<>",@new,"\n"); &lock("logdata"); &error("データが開けませんでした。","logdata",$fe) unless open(IO,'+<'.$datadir.$logdata); eval{ flock(IO,2) }; my @site = ; unshift(@site,$newlog); truncate(IO,0); seek(IO,0,0); print IO @site; close(IO); &unlock("logdata"); &mk_index(@site); &rssdata($time) if $rssmode; $action = '登録'; $showform = <
“新着”を見て、登録されていることをご確認ください。
また、[変更]から$advname情報の登録ができます。

ありがとうございました。

EOD } if($siteadmincomment || $catp){ &lock("admes"); open(IO,"+<".$datadir."admes.cgi"); eval{ flock(IO,2) }; @log = ; unshift(@log,$time."<>$name<>$email<>$sitename<>$siteurl<>$siteadmincomment<>$catp<>\n"); pop(@log) if $#log >= $maxtoadmin; truncate(IO,0); seek(IO,0,0); print IO @log; close(IO); &unlock("admes"); } if(@PL){ foreach my $i(0..$#PL){ $plog[$i] = $p[$i] if $PL[$i][4]; } } if($regmode){ &preregist_mail($name,$email,$pass,$sitename,$siteurl,$sitebanner[0],$sitebanner[1],$sitebanner[2],$cat2,$sitecomment,$sitekeyword,$time,$siteadmincomment,$catp,@plog) if $mailcheck[0][0]; }else{ ®ist_mail($name,$email,$pass,$sitename,$siteurl,$sitebanner[0],$sitebanner[1],$sitebanner[2],$cat2,$sitecomment,$sitekeyword,$time,$siteadmincomment,$catp,@plog) if $mailcheck[1][0]; } &show_html; } #登録確認 sub regist2{ $siteurl = "" if $siteurl eq "http://"; $sogourl = "" if $sogourl eq "http://"; undef(@sitebanner) if $sitebanner[0] eq "http://" || $bannerreg == 0; &datacheck; &urlcheck("logdata") if $durlcmode; &urlcheck("regreq") if $durlcmode; print "Content-type:text/html; charset=utf-8\n\n"; require $template.'regist_preview.html'; } #登録 sub regist1{ print "Content-type:text/html; charset=utf-8\n\n"; require $template.'cc_regist.html'; } #登録前の質問 sub regask{ foreach(0 .. $#rg_ask){ if(!$F{"rc$_"}){ &error("質問にはすべてお答えください。",0,$fe); } elsif($rg_ask[$_][1] ne $F{"rc$_"}){ &error("もう一度注意事項を確認してください。",0,$fe); } } ®ist1; } #管理人に通知 sub notice1{ if($notice[0] == 6){ &error("PASS再発行申\請理由をご記入ください。",0,$fe) if !$com; } elsif($notice[0] == 5){ &error("エラー解除申\請の場合、修繕内容をご記入ください。",0,$fe) if !$com; } elsif($notice[0] == 7){ &error("バナー登録禁止解除申\請の場合、バナーURLをご記入ください。",0,$fe) if $F{'sitebanner'} !~ /^http:/; } else{ &error("通知内容が不明です。",0,$fe) if(!@notice && !$com); } &error("コメントは200文字(全角換算)まででお願いします。",0,$fe) if(length("$com")>400); &lock("noticedata"); &error("データが開けませんでした。","noticedata",$fe) unless open(OUT,">>".$datadir."notice.cgi"); eval{ flock(OUT,2) }; print OUT $cid."<>@notice<>".$com."<>".$ENV{'REMOTE_ADDR'}."<>$F{'sitebanner'}<>\n"; close (OUT); &unlock("noticedata"); for(@notice){ if($_ == 5){ $notice = "エラー解除申\請"; last; } elsif($_ == 6){ $notice = "PASS再発行申\請"; last; } elsif($_ == 7){ $notice = "バナー登録禁止解除申\請"; last; } $notice = "規約違反 " if $_ == 1; $notice .= "リンク切れ " if $_ == 2; $notice .= "サイト移転 " if $_ == 3; $notice .= "バナーリンク切れ" if $_== 4; } ¬ice_mail($sitename,$notice,$com,$cid) if $mailcheck[5][0]; my $a1; if($notice[0] >= 5){ $a1 = "申\請"; }else{ $a1 = "通知"; } $showform = "サーチ管理人に$a1を行いました。
"; $showform .= "ありがとうございました。
" if $notice[0] < 5; $showform .= qq'

\n'; $action = "$a1完了"; &show_html; } sub notice{ local($csname,$err); my $flag = 0; &lock("logdata"); open(IN,$datadir.$logdata); while(){ if(index($_,"$id<") == 0){ my @ck = split("<>"); if($ck[0] eq $id){ if($pass ne $ck[12] && ($notice[0] == 5 || $notice[0] == 7)){ $flag = 1; last; } $csname = $ck[4]; $err = $ck[13]; last; } } } close (IN); &unlock("logdata"); &error("不正なアクセスです。",0,$fe) if $flag == 1; &error("このIDは存在しません。",0,$fe) if !$csname; print "Content-type:text/html; charset=utf-8\n\n"; require $template.'cc_notice.html'; } #カテゴリ表示 sub make_cat{ my @sitecat = @_; my($j,$rqc,$rct,%nct,%rqc,$c1,$c2,$c3,@c); local($category,%z1,%z2); foreach(@sitecat){ $z1{$_} = ' checked'; $z2{$_} = ' class="sl"'; } eval{ require './pl/regcat.pl' }; unless($category){ foreach(@notcate){ $nct{$_} = 1; } foreach(@reqcate2){ $rqc{$_} = 1; } my $i = 0; foreach(@reqcate){ if($i % 2 == 0){ $rqc .= "\n" if $rqc =~ /<\/tr>\n$/; $rqc .= ''; } $rqc .= '
'.($i+1).'. 選択必須カテゴリ
'."\n"; foreach $j(0..$#$_){ $rct = $reqcate[$i][$j]; $rqc .= '".&linkmake($rct,1)."
\n"; $nct{$rct} = 1; } $rqc .= "\n"; $i++; } $j = 0; my $k = -1; foreach(sort {$a cmp $b} keys %category){ if($rqc{$_}){ $c3 = $_; if($i % 2 == 0){ $rqc .= "\n" if $rqc !~ /<\/tr>\n$/; $rqc .= ''; } elsif($rqc !~ /<\/td>$/){ $rqc .= "\n"; } $rqc .= '
'.($i+1).'. 選択必須カテゴリ
'."\n"; $i++; } next if $nct{$_}; if(index($_,'-') == -1){ next if $_ eq $c3; $k++; $c[$k] .= "\n" if $c1 !~ /<\/tr>\n$/; $c[$k] .= '▼ '.$category{$_}.''; $j = 0; }else{ if($c3 && index($_,$c3) == 0){ $rqc .= '".&linkmake($_,1)."
\n"; }else{ $c[$k] .= '' if $j % 3 == 0; $c[$k] .= '".&linkmake($_,2).""; $c[$k] .= '' if $j % 3 == 2; $c[$k] .= "\n"; $j++; } } } if($rqc){ $rqc = qq'\n$rqc

\n'; } foreach(0 .. $k){ $c1 .= $c[$_] if $c[$_] =~ /input/; } if($c1){ $category = $rqc."▽以下複数選択
\n\n".$c1."
"; }else{ $category = $rqc; } } $category = < $category EOD return($category); } #表示 sub show_html{ print "Content-type:text/html; charset=utf-8\n\n"; require $template.'cc_other.html'; exit; }