#!/usr/bin/perl
$lib_db_flg = 1;
require '/home/rexi-jp/public_html/gx/lib/lib.pl';
$mycgi = 'event.cgi';
use CGI;
use CGI::Carp qw(fatalsToBrowser);
$ip = $ENV{'REMOTE_ADDR'};
$host = gethostbyaddr(pack("C4", split(/\./, $ip)), 2);
$host ||= $ENV{'REMOTE_HOST'};
$host ||= $ip;
$referer=$ENV{'HTTP_REFERER'};
$script=$ENV{'SCRIPT_NAME'};
use warnings;
use Image::Magick;
use File::Basename;
use File::Copy;
$query = CGI->new;
my @params = $query->param();#全てのパラメータ名を取得 なのでこれを$inにしてしまえば$inで使用可能
foreach my $param (@params) {
$in{$param} = $query->param($param);
}
$uid = &get_usr_cookie;
$pcid = &get_pcid_cookie;
$dbh = &connectDB($mainDB);
#&death_check($pcid,$dbh,1);
&in_enc;
%out = %in;
$out{'pdname'} = '透過全身図';
if ($in{'no'} eq 6){$out{'pdname'} = 'ピンナップ';}
elsif ($in{'no'} eq 21 and $in{'type'} eq 4){$out{'pdname'} = 'ミニチュア全身図';}
$out{'no'} = $in{'no'};
if ($in{'no'} eq 0){
$adm_date = "20090731";
}
elsif ($in{'no'} eq 1){
$out{'title'} = '夏コン';
$adm_date = "20090823";
}
elsif ($in{'no'} eq 2){
$out{'title'} = '女神コン';
$adm_date = "20090923";
}
elsif ($in{'no'} eq 3){
$out{'title'} = 'アニコン';
$adm_date = "20091023";
}
elsif ($in{'no'} eq 4){
$adm_date = "20091120";
if ($in{'type'} eq 1){$out{'title'} = 'ミスターローレック';}
elsif ($in{'type'} eq 2){$out{'title'} = 'ミスローレック';}
elsif ($in{'type'} eq 3){
$out{'title'} = '樽コン';
$out{'pdname'} = 'アイコン';
}
}
elsif ($in{'no'} eq 5){
$adm_date = "20091229";
$out{'title'} = 'パーティコン';
if ($in{'type'} eq 1){$out{'title'} .= '紳士部門';}
if ($in{'type'} eq 2){$out{'title'} .= '淑女部門';}
if ($in{'type'} eq 3){$out{'title'} .= 'ピエロ部門';}
}
elsif ($in{'no'} eq 6){
$out{'title'} = '聖夜コン';
$adm_date = "20100106";
}
elsif ($in{'no'} eq 7){
$adm_date = "20100216";
$poll_close = "201003240000";
$out{'title'} = '愛コン';
if ($in{'type'} eq 1){$out{'title'} .= 'ベストカップル部門';}
if ($in{'type'} eq 2){$out{'title'} .= 'ベストパートナー部門';}
if ($in{'type'} eq 3){$out{'title'} .= 'ベストファンタジー部門';}
}
elsif ($in{'no'} eq 8){
$adm_date = "20100430";
$poll_close = "201005180000";
$out{'title'} = '夏服コン';
if ($in{'type'} eq 1){$out{'title'} .= '男子通常制服部門';}
if ($in{'type'} eq 2){$out{'title'} .= '女子通常制服部門';}
if ($in{'type'} eq 3){$out{'title'} .= '男子改造制服部門';}
if ($in{'type'} eq 4){$out{'title'} .= '女子改造制服部門';}
}
elsif ($in{'no'} eq 9){
$adm_date = "20100412";
$poll_close = "201005100000";
$out{'title'} = '学生会長選挙投票';
}
elsif ($in{'no'} eq 10){
$adm_date = "20100601";
$poll_close = "201006245959";
$out{'title'} = 'ユニコン';
if ($in{'type'} eq 1){$out{'title'} .= '運動着部門';}
if ($in{'type'} eq 2){$out{'title'} .= 'スクール水着部門';}
}
elsif ($in{'no'} eq 11){
$adm_date = "20100720";
$poll_close = "201008161700";
$out{'title'} = '夏コン1010';
if ($in{'type'} eq 1){$out{'title'} .= '夏娘部門';}
if ($in{'type'} eq 2){$out{'title'} .= '夏男部門';}
if ($in{'type'} eq 3){$out{'title'} .= '浴衣娘部門';}
if ($in{'type'} eq 4){$out{'title'} .= '浴衣男部門';}
}
elsif ($in{'no'} eq 12){
$adm_date = "20100820";
$poll_close = "201010121200";
$out{'title'} = '戦コン';
if ($in{'type'} eq 1){$out{'title'} .= 'ビフォー部門';}
if ($in{'type'} eq 2){$out{'title'} .= 'アフター部門';}
}
elsif ($in{'no'} eq 13){
$adm_date = "20101025";
$poll_close = "201011291200";
# $out{'title'} = '戦コン';
if ($in{'type'} eq 1){$out{'title'} .= 'ミスターローレック';}
elsif ($in{'type'} eq 2){$out{'title'} .= 'ミスローレック';}
elsif ($in{'type'} eq 3){
$out{'title'} .= '学生証コンテスト(男子学生証部門)';
$out{'pdname'} = '学生証ウェストアップ';
}
elsif ($in{'type'} eq 4){
$out{'title'} .= '学生証コンテスト(女子学生証部門)';
$out{'pdname'} = '学生証ウェストアップ';
}
elsif ($in{'type'} eq 5){
$out{'title'} .= 'スマイルアイコンコンテスト';
$out{'pdname'} = 'アイコン';
}
}
elsif ($in{'no'} eq 14){
$adm_date = "20101125";
$poll_close = "201101051300";
$out{'title'} = 'クリコン';
}
elsif ($in{'no'} eq 15){
$adm_date = "20110301";
$poll_close = "201103081300";
$out{'title'} = '愛コン';
if ($in{'type'} eq 1){$out{'title'} .= 'ベストカップル部門';}
if ($in{'type'} eq 2){$out{'title'} .= 'ベストパートナー部門';}
if ($in{'type'} eq 3){$out{'title'} .= 'ベストファンタジー部門';}
}
elsif ($in{'no'} eq 16){
$adm_date = "20110501";
$poll_close = "201105180000";
$out{'title'} = '夏服コン';
if ($in{'type'} eq 1){$out{'title'} .= '男子通常制服部門';}
if ($in{'type'} eq 2){$out{'title'} .= '男子改造制服部門';}
if ($in{'type'} eq 3){$out{'title'} .= '女子通常制服部門';}
if ($in{'type'} eq 4){$out{'title'} .= '女子改造制服部門';}
}
elsif ($in{'no'} eq 17){
$adm_date = "20110425";
$poll_close = "201105180000";
$out{'title'} = '学生会長選挙投票';
}
elsif ($in{'no'} eq 18){
$adm_date = "20110601";
$poll_close = "201107251300";
$out{'title'} = 'グリコン';
if ($in{'type'} eq 1){$out{'title'} .= '男子グリーヴァ衣装部門';}
if ($in{'type'} eq 2){$out{'title'} .= '女子グリーヴァ衣装部門';}
if ($in{'type'} eq 3){$out{'title'} .= 'グリーブス部門';}
}
elsif ($in{'no'} eq 19){
$adm_date = "20110701";
$poll_close = "201109061300";
$out{'title'} = '夏コン';
if ($in{'type'} eq 1){$out{'title'} .= '夏娘部門';}
if ($in{'type'} eq 2){$out{'title'} .= '夏男部門';}
}
elsif ($in{'no'} eq 20){
$adm_date = "20110701";
$poll_close = "201109061300";
$out{'title'} = 'ダンスコン';
if ($in{'type'} eq 1){$out{'title'} .= '';}
}
elsif ($in{'no'} eq 21){
$adm_date = "20111004";
$poll_close = "201110241300";
if ($in{'type'} ne 4){
$out{'title'} .= '仮装コンテスト';
if ($in{'type'} eq 1){
$out{'title'} = '仮装娘部門';
}elsif ($in{'type'} eq 2){
$out{'title'} = '仮装男部門';
}elsif ($in{'type'} eq 3){
$out{'title'} = 'オモシロ仮装部門';
}
}else{
$out{'title'} .= '人形劇コンテスト';
}
}
elsif ($in{'no'} eq 22){
$adm_date = "20111108";
$poll_close = "201111242200";
$poll_close2 = "201111281300";
if ($in{'type'} ne 3){
$out{'title'} .= 'ミス&ミスター コンテスト';
if ($in{'type'} eq 1){
$out{'title'} .= ' ミスター部門';
}elsif ($in{'type'} eq 2){
$out{'title'} .= ' ミス部門';
}
}else{
$out{'title'} .= 'X意匠アイコン コンテスト';
}
}else{
@num_title = ();
$sql = "select title,adm_date,poll_close,poll_close2,num1,num2,num3,num4,npc,pol_sheet,fame_lmit,num1_type,num2_type ,num3_type ,num4_type from contest_master where no = $in{'no'} and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-01 エラーが発生しました。");
($out{'title'},$adm_date,$poll_close,$poll_close2,@num_title[1],@num_title[2],@num_title[3],@num_title[4],$npc,$pol_sheet,$out{'fame_lmit'},$num1_type,$num2_type ,$num3_type ,$num4_type)=@{$ref->[0]};
if($in{'no'} eq 33){
@num_title[5] ='裏部門';
}
if($out{'title'} eq ''){
&err("不正なパラメータ");
}
if($in{'type'} ne ''){
if(@num_title[$in{'type'}] ne ''){
$out{'title'} .= ' '.@num_title[$in{'type'}];
}else{
&err("不正なパラメータ");
}
}
if($in{'type'} eq 1){
$num_type = $num1_type;
}elsif($in{'type'} eq 2){
$num_type = $num2_type;
}elsif($in{'type'} eq 3){
$num_type = $num3_type;
}elsif($in{'type'} eq 4){
$num_type = $num4_type;
}else{
$num_type = $num1_type;
}
}
if($out{'fame_lmit'} eq ''){
$out{'fame_lmit'} =40;
}
&date_rtn;
if ($in{'mode'} eq 'entry'){
&entry;
}
elsif ($in{'mode'} eq 'entry_conf'){
&entry_conf;
}
elsif ($in{'mode'} eq 'entry_conf2'){
&entry_conf2;
}
elsif ($in{'mode'} eq 'entry_conf3'){
&entry_conf3;
}
elsif ($in{'mode'} eq 'entry_conf4'){
&entry_conf4;
}
elsif ($in{'mode'} eq 'entry_exe'){
&entry_exe;
}
elsif ($in{'mode'} eq 'list'){
&list;
}
elsif ($in{'mode'} eq 'poll_list'){
&poll_list;
}
elsif ($in{'mode'} eq 'poll_conf'){
&poll_conf;
}
elsif ($in{'mode'} eq 'poll_reg'){
&poll_reg;
}
elsif ($in{'mode'} eq 'roll_list'){
&roll_list;
}
elsif ($in{'mode'} eq 'poll_amount'){
&poll_amount;
}
elsif ($in{'mode'} eq 'poll_dt'){
&poll_dt;
}
elsif ($in{'mode'} eq 'admission'){
&admission;
}
elsif ($in{'mode'} eq 'admission_exe'){
&admission_exe;
}
elsif ($in{'mode'} eq 'img_composite'){
&img_composite;
}
elsif ($in{'mode'} eq 'data_move'){
&data_move;
}
elsif ($in{'mode'} eq 'image_sum'){
&image_sum;
}
else{
&err("不正なパラメータ");
}
&disconDB($dbh);
exit;
#---------------------------------------
# 簡易集計
#---------------------------------------
sub poll_amount {
if ($in{'no'} eq 6){
$sql = "select target from event_poll where no = $in{'no'};";
$ref = $dbh->selectall_arrayref($sql) or $err=1;
foreach(@$ref) {
($target)=@{$_};
@a = ();
@a = split(/\,/,$target);
foreach(@a){
$tmp = $_;
if ($poll_d{$tmp} eq ''){$poll_d{$tmp} = 0;}
$poll_d{$tmp}++;
}
}
$rank = 1;
foreach $key (sort { $poll_d{$b} <=> $poll_d{$a} } keys %poll_d){
$sql = "select name from character where pcid = '$key';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-02 エラーが発生しました。");
($pcname)=@{$ref->[0]};
$body .=<<"EOT";
$rank:$poll_d{$key}:$pcname($key)
EOT
$rank++;
}
}
elsif ($in{'no'} eq 8 || $in{'no'} eq 11){
%type1 = ();
%type2 = ();
%type3 = ();
%type4 = ();
$sql = "select target from event_poll where no = $in{'no'};";
$ref = $dbh->selectall_arrayref($sql) or $err=1;
foreach(@$ref) {
($target)=@{$_};
@a = ();
@a = split(/\,/,$target);
$i = 1;
foreach(@a){
$tmp = $_;
if ($i >= 1 && $i <= 3){
if ($type1{$tmp} eq ''){$type1{$tmp} = 0;}
$type1{$tmp}++;
}
if ($i >= 4 && $i <= 6){
if ($type2{$tmp} eq ''){$type2{$tmp} = 0;}
$type2{$tmp}++;
}
if ($i >= 7 && $i <= 9){
if ($type3{$tmp} eq ''){$type3{$tmp} = 0;}
$type3{$tmp}++;
}
if ($i >= 10 && $i <= 12){
if ($type4{$tmp} eq ''){$type4{$tmp} = 0;}
$type4{$tmp}++;
}
$i++;
}
}
$body .= '■ ';
$rank = 1;
foreach $key (sort { $type1{$b} <=> $type1{$a} } keys %type1){
$sql = "select name from character where pcid = '$key';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($pcname)=@{$ref->[0]};
$body .=<<"EOT";
$rank:$type1{$key}:$pcname($key)
EOT
$rank++;
}
$body .= '■ ';
$rank = 1;
foreach $key (sort { $type2{$b} <=> $type2{$a} } keys %type2){
$sql = "select name from character where pcid = '$key';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-04 エラーが発生しました。");
($pcname)=@{$ref->[0]};
$body .=<<"EOT";
$rank:$type2{$key}:$pcname($key)
EOT
$rank++;
}
$body .= '■ ';
$rank = 1;
foreach $key (sort { $type3{$b} <=> $type3{$a} } keys %type3){
$sql = "select name from character where pcid = '$key';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-05 エラーが発生しました。");
($pcname)=@{$ref->[0]};
$body .=<<"EOT";
$rank:$type3{$key}:$pcname($key)
EOT
$rank++;
}
$body .= '■ ';
$rank = 1;
foreach $key (sort { $type4{$b} <=> $type4{$a} } keys %type4){
$sql = "select name from character where pcid = '$key';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-06 エラーが発生しました。");
($pcname)=@{$ref->[0]};
$body .=<<"EOT";
$rank:$type4{$key}:$pcname($key)
EOT
$rank++;
}
}
elsif ($in{'no'} eq 7 || $in{'no'} eq 10){
%type1 = ();
%type2 = ();
%type3 = ();
%type4 = ();
$sql = "select b.uid from event_poll a,character b where a.no = $in{'no'} and a.pcid = b.pcid group by b.uid order by b.uid;";
$ref = $dbh->selectall_arrayref($sql) or $err=1;
foreach(@$ref) {
($post_uid)=@{$_};
$body .= "$post_uid ";
%temp1 = ();
%temp2 = ();
%temp3 = ();
%temp4 = ();
$sql2 = "select a.pcid,b.name,a.target from event_poll a,character b where a.no = $in{'no'} and a.pcid = b.pcid and b.uid = $post_uid order by a.pcid;";
$ref2 = $dbh->selectall_arrayref($sql2) or $err=1;
foreach(@$ref2) {
($ppcid,$pname,$target)=@{$_};
$body .= "$pname($ppcid) $target ";
@a = ();
@a = split(/\,/,$target);
$temp1{@a[0]} = 1;
$temp1{@a[1]} = 1;
$temp1{@a[2]} = 1;
$temp2{@a[3]} = 1;
$temp2{@a[4]} = 1;
$temp2{@a[5]} = 1;
$temp3{@a[6]} = 1;
$temp3{@a[7]} = 1;
$temp3{@a[8]} = 1;
$temp4{@a[9]} = 1;
$temp4{@a[10]} = 1;
$temp4{@a[11]} = 1;
}
foreach $key (keys %temp1){
if ($temp1{$key} eq 1){
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$n_file = substr($key,14);
$sql2 = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$epcid' and tar_pcid = '$tar_pcid' and file_name = '$n_file' and agreement = 1;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-07 エラーが発生しました。");
($t)=@{$ref2->[0]};
if ($t > 0){
if ($type1{$key} eq ''){$type1{$key} = 0;}
$type1{$key}++;
}
}
}
foreach $key (keys %temp2){
if ($temp2{$key} eq 1){
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$n_file = substr($key,14);
$sql2 = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$epcid' and tar_pcid = '$tar_pcid' and file_name = '$n_file' and agreement = 1;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-08 エラーが発生しました。");
($t)=@{$ref2->[0]};
if ($t > 0){
if ($type2{$key} eq ''){$type2{$key} = 0;}
$type2{$key}++;
}
}
}
foreach $key (keys %temp3){
if ($temp3{$key} eq 1){
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$n_file = substr($key,14);
$sql2 = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$epcid' and tar_pcid = '$tar_pcid' and file_name = '$n_file' and agreement = 1;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-09 エラーが発生しました。");
($t)=@{$ref2->[0]};
if ($t > 0){
if ($type3{$key} eq ''){$type3{$key} = 0;}
$type3{$key}++;
}
}
}
foreach $key (keys %temp4){
if ($temp4{$key} eq 1){
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$n_file = substr($key,14);
$sql2 = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$epcid' and tar_pcid = '$tar_pcid' and file_name = '$n_file' and agreement = 1;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-10 エラーが発生しました。");
($t)=@{$ref2->[0]};
if ($t > 0){
if ($type4{$key} eq ''){$type4{$key} = 0;}
$type4{$key}++;
}
}
}
}
if ($in{'no'} eq 7){
$title1 = 'ベストカップル部門';
$title2 = 'ベストパートナー部門';
$title3 = 'ベストファンタジー部門';
}
elsif ($in{'no'} eq 10){
$title1 = '公式運動着部門';
$title2 = '公式スクール水着部門';
$title3 = '裏運動着部門';
$title4 = '裏スクール水着部門';
}
$body .=<<"EOT";
$title1
EOT
$rank = 1;
$prv_pts = 0;
$stock = 0;
foreach $key (sort { $type1{$b} <=> $type1{$a} } keys %type1){
if ($prv_pts eq 0){$prv_pts = $type1{$key};}
elsif ($type1{$key} ne $prv_pts){
$rank++;
if ($stock > 0){$rank += $stock;}
$stock = 0;
$prv_pts = $type1{$key};
}
else{$stock++;}
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$sql2 = "select name from character where pcid = '$epcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-11 エラーが発生しました。");
($name1)=@{$ref2->[0]};
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-12 エラーが発生しました。");
($name2)=@{$ref2->[0]};
$body .=<<"EOT";
$rank:$type1{$key} $name1($epcid)&$name2($tar_pcid)
EOT
}
$body .=<<"EOT";
$title2
EOT
$rank = 1;
$prv_pts = 0;
$stock = 0;
foreach $key (sort { $type2{$b} <=> $type2{$a} } keys %type2){
if ($prv_pts eq 0){$prv_pts = $type2{$key};}
elsif ($type2{$key} ne $prv_pts){
$rank++;
if ($stock > 0){$rank += $stock;}
$stock = 0;
$prv_pts = $type2{$key};
}
else{$stock++;}
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$sql2 = "select name from character where pcid = '$epcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-13 エラーが発生しました。");
($name1)=@{$ref2->[0]};
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-14 エラーが発生しました。");
($name2)=@{$ref2->[0]};
$body .=<<"EOT";
$rank:$type2{$key} $name1($epcid)&$name2($tar_pcid)
EOT
}
$body .=<<"EOT";
$title3
EOT
$rank = 1;
$prv_pts = 0;
$stock = 0;
foreach $key (sort { $type3{$b} <=> $type3{$a} } keys %type3){
if ($prv_pts eq 0){$prv_pts = $type3{$key};}
elsif ($type3{$key} ne $prv_pts){
$rank++;
if ($stock > 0){$rank += $stock;}
$stock = 0;
$prv_pts = $type3{$key};
}
else{$stock++;}
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$sql2 = "select name from character where pcid = '$epcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-15 エラーが発生しました。");
($name1)=@{$ref2->[0]};
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-16 エラーが発生しました。");
($name2)=@{$ref2->[0]};
$body .=<<"EOT";
$rank:$type3{$key} $name1($epcid)&$name2($tar_pcid)
EOT
}
$body .=<<"EOT";
EOT
if ($in{'no'} eq 10){
$body .=<<"EOT";
$title4
EOT
$rank = 1;
$prv_pts = 0;
$stock = 0;
foreach $key (sort { $type4{$b} <=> $type4{$a} } keys %type4){
if ($prv_pts eq 0){$prv_pts = $type4{$key};}
elsif ($type4{$key} ne $prv_pts){
$rank++;
if ($stock > 0){$rank += $stock;}
$stock = 0;
$prv_pts = $type3{$key};
}
else{$stock++;}
$epcid = substr($key,0,6);
$tar_pcid = substr($key,7,6);
$sql2 = "select name from character where pcid = '$epcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-17 エラーが発生しました。");
($name1)=@{$ref2->[0]};
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-18 エラーが発生しました。");
($name2)=@{$ref2->[0]};
$body .=<<"EOT";
$rank:$type4{$key} $name1($epcid)&$name2($tar_pcid)
EOT
}
$body .=<<"EOT";
EOT
}
}
&err($body);
}
#---------------------------------------
# 投票詳細
#---------------------------------------
sub poll_dt {
$sql = "select a.target,a.pcid,b.name,b.uid from event_poll a,character b where a.no = $in{'no'} and a.target like '%" . $in{'target'} . "%' and a.pcid = b.pcid order by b.uid;";
$ref = $dbh->selectall_arrayref($sql) or &err("$sql");
foreach(@$ref) {
($target,$p_pcid,$p_name,$p_uid)=@{$_};
@a = ();
@a = split(/\,/,$target);
$i = 1;
foreach(@a){
$flg = 0;
if ($in{'type'} eq ''){$flg = 1;}
elsif ($in{'type'} eq 1 && $i >= 1 && $i <= 3 && $in{'target'} eq $_){$flg = 1;}
elsif ($in{'type'} eq 2 && $i >= 4 && $i <= 6 && $in{'target'} eq $_){$flg = 1;}
elsif ($in{'type'} eq 3 && $i >= 7 && $i <= 9 && $in{'target'} eq $_){$flg = 1;}
elsif ($in{'type'} eq 4 && $i >= 10 && $i <= 12 && $in{'target'} eq $_){$flg = 1;}
if ($flg eq 1){
$body .=<<"EOT";
$p_uid:$p_name($p_pcid)
EOT
}
$i++;
}
}
&err($body);
}
#---------------------------------------
# 縮小
#---------------------------------------
sub image_sum {
$say_dir = "/home/rexi-jp/public_html/gx/event/con_thumbnail/xh06/";
@resdat = ();
$rcnt = 0;
opendir(DH, $say_dir);
while (my $file = readdir DH) {
next if $file =~ /^\.{1,2}$/; # '.'や'..'も取れるので、スキップする
if (!-d "$say_dir$file"){
push resdat,$file;
$rcnt++;
}
}
closedir DH;
foreach(@resdat){
$tmp = $_;
$img_b = "/home/rexi-jp/public_html/gx/event/con_thumbnail/xh06/" . $tmp;
$img_f = "/home/rexi-jp/public_html/gx/event/con_thumbnail/xh06_png/" . substr($tmp,0,-4) . "_s" . substr($tmp,-4);
system "convert -resize x100 +profile iptc -quality 100 $img_b $img_f";
}
&err("終了");
}
#---------------------------------------
# ロール一覧
#---------------------------------------
sub roll_list {
if ($in{'dbg'} eq 1){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 2){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 3){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 4){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 5){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 6){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 7){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 8){
$out{'js'} =<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 9){
$out{'js'} =<<"EOT";
EOT
}
$cnt = 0;
$entry_flg =0;
$sql = "select pcid,name,url,file_name,comment,tar_pcid,url2 from contest_entry where no = $in{'no'} and (agreement is null or agreement = 1)";
if ($in{'type'} ne ''){$sql .= " and type = $in{'type'}";}
$sql .= " and state = 0 order by reg_date;";
$ref = $dbh->selectall_arrayref($sql) or $err=1;
foreach(@$ref) {
($epcid,$ename,$url,$file_name,$comment,$tar_pcid,$url2)=@{$_};
$entry_flg =1;
$cnt++;
$comment =~ s/</g;
$comment =~ s/>/>/g;
$n_file = "/home/rexi-jp/public_html/" . substr($url,15);
$t_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . $file_name;
$span_body = "$ename($epcid)\n$comment";
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){
$n_file = '/home/rexi-jp/public_html/gx/event/con_image/' . $epcid . '_' . $tar_pcid . '_' . $file_name;
$t_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . $epcid . '_' . $tar_pcid . '_' . $file_name;
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-19 エラーが発生しました。");
($tar_name)=@{$ref2->[0]};
$span_body = "$ename($epcid)&$tar_name($tar_pcid)\n$comment";
}
if($num_type < 10){
if (!-e $t_file){
if($in{'no'} eq 21 && $in{'type'} eq 4){
my $image = Image::Magick->new;
my %info;
$image->Read($n_file);
# 背景色しかない部分を切り落とす
# $image->Trim();
# この他の切り抜き関数としては、座標を数値で指定するCropがあります。
# 下の2つの指定はどちらも同じ結果になります。
## $image->Crop(width=>260, x=>20, y=>210);
$image->Crop( y=>200);
##$image->Crop(width=>26, height=>26, x=>287, y=>251);
# $image->Crop(geometry=>"26×26+287+251");
# この下の2行がミソ
# Image::Magick 内では切り抜き後の画像のサイズを
# 画像のサイズとして保持していますが、Set 関数で page を以下のように
# 指定しないと、書き出されるファイルに切り落としたはずの部分が
# 入ってしまいます。
@info{'width', 'height'} = $image->Get('width', 'height');
$image->Set(page=>"$info{width}x$info{height}+0+0");
my ($now_width, $now_height) = $image->Get('width', 'height');
## $image->Resize(
## width => int($now_width / 1.3) #
## , height => int($now_height / 1.3) #100% -> 50%
## , blur => 0.8
## );
$image->Write($t_file);
$size = 'x300';
}else{
if ($in{'no'} eq 6){$size = 'x300';}
else{
$size = 'x400';
}
system "convert -resize $size +profile iptc -quality 100 $n_file $t_file";
}
}
$s_file = "./con_thumbnail/$file_name";
if (($in{'no'} eq 4 && $in{'type'} eq 3) || ($in{'no'} eq 13 && ($in{'type'} eq 5 || $in{'type'} eq 3 || $in{'type'} eq 4))){$s_file = "../../stars/data/gx/$file_name";}
if ($in{'no'} eq 22 && $in{'type'} eq 3){$s_file = "../../stars/data/gx/$file_name";}
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){$s_file = "./con_thumbnail/" . $epcid . '_' . $tar_pcid . '_' . $file_name;}
}else{ ##ボイス
##########$file_name = 'http://rexi.jp/stars/data/gx/gx_xb3378_V01_0895_04.mp3';
$s_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/".$in{'no'}."_".$in{'type'}."_".$epcid.".png";
$t_file = "/gx/event/con_thumbnail/".$in{'no'}."_".$in{'type'}."_".$epcid.".png";
if (!-e $t_file){
my $image = Image::Magick->new;
## $image->Set(size=>'400x160');
## $image->ReadImage('xc:white'); # バック白
##&err("------");
if($in{'no'} eq 39){
$image->Read('http://rexi.jp/gx/event/tmp/xh30_roll_base.png');
}else{
$image->Read('http://rexi.jp/gx/event/tmp/roll_base.png');
}
# 重ねる画像を読み込む
my $image2 = Image::Magick->new;
$image2->Read($url2);
# 画像を合成する(アイコン)
$image->Composite(image=>$image2, compose=>'Over', x=>0, y=>0);
#名前
$image = &text_set($image,"$ename($epcid)",'admin/font/KozGoPro-Medium.otf','14','40','80','UTF-8');
#セリフ
$comment =~ s/\n//g;
$comment =~ s/\r//g;
$comment =~ s/ //g;
if(length($comment) <= 40){
$image = &text_set($image,$comment,'admin/font/KozGoPro-Medium.otf','16','30','150','UTF-8');
}elsif(length($comment) <= 200){
$ii_max=int(length($comment) / 40);
for($ii=0;$ii <= $ii_max; $ii++){
$w_comment = substr($comment,$ii * 40,40);
$iy = 150 + ($ii * 35);
$image = &text_set($image,$w_comment,'admin/font/KozGoPro-Medium.otf','16','30',$iy,'UTF-8');
}
}else{
$ii_max=int(length($comment) / 40);
for($ii=0;$ii <= 5; $ii++){
$w_comment = substr($comment,$ii * 40,40);
$iy = 150 + ($ii * 35);
if($ii eq 5){
$w_comment .='…';
}
$image = &text_set($image,$w_comment,'admin/font/KozGoPro-Medium.otf','16','30',$iy,'UTF-8');
}
}
## $image->Write("png:$s_file");
$image->Write($s_file);
}
}
############&err("=================================");
###$s_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . $file_name;
($format,$width,$height) = &GetImageSize($s_file);
##&err($width."--".$height.">".$s_file);
if($num_type < 10){
if ($in{'dbg'} eq ''){
$body .=<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 2){
$body .=<<"EOT";
EOT
}else{
$body .=<<"EOT";
EOT
}
}else{
if ($in{'dbg'} eq ''){
$body .=<<"EOT";
EOT
}
elsif ($in{'dbg'} eq 2){
}else{
}
}
}
if ($in{'no'} eq 5){
$dbh_jj = &connectDB('jj');
$sql2 = "select pcid,name2 || '/' || name1,url,file_name,comment from contest_entry where no = 1";
if ($in{'type'} ne '' && $in{'type'} > 0){$sql2 .= " and type = $in{'type'}";}
$sql2 .= " order by reg_date;";
$ref2 = $dbh_jj->selectall_arrayref($sql2) or $err=1;
foreach(@$ref2) {
($epcid,$ename,$url,$file_name,$comment)=@{$_};
$cnt++;
$n_file = "/home/rexi-jp/public_html/" . substr($url,15);
$t_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . $file_name;
if (!-e $t_file){
system "convert -resize x400 +profile iptc -quality 100 $n_file $t_file";
}
$s_file = "./con_thumbnail/$file_name";
if ($in{'no'} eq 4 && $in{'type'} eq 3){$s_file = "../../stars/data/gx/$file_name";}
($format,$width,$height) = &GetImageSize($s_file);
$body2 .=<<"EOT";
EOT
}
&disconDB($dbh_jj);
}
chomp $body;
# if ($body eq ''){exit;}
##################&err("-- $body2");
if($entry_flg eq 1){
if ($in{'dbg'} eq ''){
$body =<<"EOT";
$body
$body2
EOT
}
}else{
$body =<<"EOT";
エントリー募集中!
EOT
}
$c = int($cnt / 2);
if (($cnt / 2) > $c){$c++;}
if ($c < 2){$c=2;}
$out{'cnt'} = $c;
$out{'body'} = $body;
if($num_type < 10){
if ($in{'iframe'} eq 1){
$htmlfile = "event_entry_roll2.html";
# if ($in{'dbg'} eq 1){$htmlfile = "event_entry_roll4.html";}
if ($in{'dbg'} ne ''){$htmlfile = "event_entry_roll_x.html";}
}
else{$htmlfile = "event_entry_roll.html";}
}else{
if ($in{'iframe'} eq 1){
$htmlfile = "event_entry_roll_v2.html";
}else{
$htmlfile = "event_entry_roll_v.html";
}
}
&out_enc;
&html_out($htmlfile);
}
#---------------------------------------
# ミスコンエントリー
#---------------------------------------
sub entry {
if($pcid ne 'xd0024'){ #--オレは抜かす。
# &err("現在、メンテナンス中です。 ご迷惑おかけしますが、もう暫くお待ちください。");
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
if ($in{'no'} eq ''){&err("開催回数が選択されていません。");}
if ($in{'no'} eq 2){
#if ("$g_year$g_mon$g_mday$g_hour$g_min" < "200909180000" || "$g_year$g_mon$g_mday$g_hour$g_min" > "200909292200"){&err("エントリー期間でない為、利用できません。");}
}
if ($in{'no'} eq 4 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 5 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 7 && substr($pcid,1,1) eq 'z'){&err("NPCはエントリーできません。");}
if ($in{'no'} eq 10 && substr($pcid,1,1) eq 'z'){&err("NPCはエントリーできません。");}
if ($in{'no'} eq 10 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 15 && substr($pcid,1,1) eq 'z'){&err("NPCはエントリーできません。");}
if ($in{'no'} eq 15 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 20 && substr($pcid,1,1) eq 'z'){&err("NPCはエントリーできません。");}
}
#-- イヴェント番号が23以上の処理
if ($in{'no'} >= 23){
if($npc eq 1 && substr($pcid,1,1) eq 'z'){ &err("NPCはエントリーできません。"); }
if($uid ne 535 && $uid ne 4210){ #-- スーパーユーザーは素通り
if("$g_year$g_mon$g_mday$g_hour$g_min" >= $poll_close){ &err("エントリー期間を過ぎています。"); }
if ($in{'type'} eq ''){
if(@num_title[1] ne ''){ &err("エントリータイプが指定されていません。"); }
}else{
if(@num_title[$in{'type'}] eq ''){ &err("エントリータイプが指定されていません。");}
}
}
}
#-- エントリー済みかどうか確認。
#-- イベントエントリーテーブル参照
$sql = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$pcid'";
if ($in{'type'} ne '' && $in{'type'} > 0){$sql .= " and type = $in{'type'}";}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-20 エラーが発生しました。");
($cnt)=@{$ref->[0]};
if ($cnt ne '' && $cnt > 0 && ($in{'no'} ne 7 && $in{'no'} ne 10 && $in{'no'} ne 14 && $in{'no'} ne 15 && $in{'no'} ne 25 && $in{'no'} ne 36)){&err("エントリー済みの為、新たにエントリーできません。");}
#--
if ($in{'no'} eq 4 && $in{'type'} eq 3){$where = "and pdid in ('C02','C08')";
}elsif ($in{'no'} eq 4 && $in{'type'} > 0){$where = "and pdid in ('G01','C14')";
# }elsif ($in{'no'} >= 1){$where = "and pdid = 'G01'";
}elsif ($in{'no'} eq 6){$where = "and pdid = 'C05'";
}elsif ($in{'no'} eq 13){
$where = "and pdid in ('G01','C14')";
if ($in{'type'} eq 3 || $in{'type'} eq 4){$where = "and pdid = 'G04'";}
elsif ($in{'type'} eq 5){$where = "and pdid in ('C02','C08')";}
}elsif ($in{'no'} eq 21){
if ($in{'type'} ne 4 ){
$where = "and pdid in ('G01','C14')";
}elsif ($in{'type'} eq 4 ){
$where = "and pdid = 'C10'";
}
}elsif ($in{'no'} eq 22){
if ($in{'type'} ne 3 ){$where = "and pdid in ('G01','C14')";}
else{$where = "and pdid in ('C02','C08')";}
## }elsif ($in{'no'} eq 24){
## $where = "and pdid in('C04' , 'C05')";
}elsif ($in{'no'} >= 1){
if($num_type eq 0){
$where = "and pdid in ('G01','C14')";
}elsif($num_type eq 1){
$where = "and pdid in ('C04','C05')";
}elsif($num_type eq 2){
$where = "and pdid in ('G01','C14')";
}elsif($num_type eq 4){ ##学生証
$where = "and pdid in ('G04')";
}elsif($num_type eq 10){ ##ショートボイス
$where = "and pdid in ('V01')";
}
}
#-- 種族データを得れるように改造
$i = 0;
$sql = "select sd.file_name,sd.url,sd.comment,ch.race from stars_data sd ";
if($uid eq "4210"){ #実験用 #DEMO
$sql .= "left join character ch on sd.pcid = ch.pcid where sd.pcid = '$pcid' $where and sd.crid != 'rexi' order by sd.reg_date desc;";
}else{
$sql .= "left join character ch on sd.pcid = ch.pcid where sd.pcid = '$pcid' $where and sd.crid != 'rexi' and sd.state = 0 order by sd.reg_date desc;";
}
# if ($pcid eq 'xz0000'){$sql = "select file_name,url from stars_data where pcid = '$pcid' $where and state = 0 order by reg_date desc;";}
#-- 竹本スペシャル
if ($uid eq 2) {$sql = "select file_name,url,comment from stars_data where pcid = '$pcid' $where and state = 0 order by reg_date desc;";}
$ref = $dbh->selectall_arrayref($sql) or &err("CODE-1214:エラーが発生しました。");
#-- ファイルネーム等の処理
foreach(@$ref) {
($file_name,$url,$comment_v,$race)=@{$_};
#-- エントリー済みならフラグ0
if ($in{'no'} eq 7 || $in{'no'} eq 8 || $in{'no'} eq 10 || $in{'no'} eq 14 || $in{'no'} eq 15){
# $sql2 = "select count(*) from contest_entry where (file_name = '$file_name' or file_name2 = '$file_name') and no = $in{'no'};";
$sql2 = "select count(*) from contest_entry where file_name = '$file_name' and no = $in{'no'};";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-21 エラーが発生しました。");
($cnt)=@{$ref2->[0]};
if ($cnt > 0){$flg = 0;}
else{$flg = 1;}
}else{
$flg = 1;
}
# 第21回イヴェント
if($in{'no'} eq 21){
$sql2 = "select count(*) from contest_entry where url = '$url' and no = $in{'no'};";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-22 エラーが発生しました。");
($cnt)=@{$ref2->[0]};
if ($cnt > 0){$flg = 0;}
else{$flg = 1;}
}
#第22回の3
if($in{'no'} eq 22 and $in{'type'} ne 3){
$sql2 = "select count(*) from contest_entry where url = '$url' and no = $in{'no'};";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-23 エラーが発生しました。");
($cnt)=@{$ref2->[0]};
if ($cnt > 0){$flg = 0;}
else{$flg = 1;}
}
#第23回
if($in{'no'} >= 23 ){
$sql2 = "select count(*) from contest_entry where url = '$url' and no = $in{'no'};";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-24 エラーが発生しました。");
($cnt)=@{$ref2->[0]};
if ($cnt > 0){$flg = 0;}
else{$flg = 1;}
}
#---------------------------------------------------------------
#-- でかいサムネ
if (($in{'no'} eq 4 && $in{'type'} eq 3) or ($in{'no'} eq 13 && $in{'type'} eq 5) or ($in{'no'} eq 22 && $in{'type'} eq 3)){
$th_url = "../../stars/data/gx/$file_name";
if (index($url,'images') > 0){$th_url = $url;}
$w = 50;
$h = 50;
}else{ #-- 通常のサムネール
$th_url = "../../stars/data/gx_thumbnail/$file_name";
$w = 50;
$h = 100;
($format,$w,$h) = &GetImageSize($th_url);
}
#-- 自分がシフールなら
if(($in{'no'} eq 36 || $in{'no'} eq 37) && $race eq 6){
$url = "http://rexi.jp/stars/data/gx_shefool/$file_name";
if (index($url,'images') > 0){$th_url = $url;}
$w = '';
$h = '';
}
#-- シフール用フラグデータ
if($race eq 6 ){$rcbt = " \n"; }else{ $rcbt = ""; }
#---------------------------------------------------------------
if ($i eq 0){
$out{'body'} .=<<"EOT";
EOT
}
if ($flg eq 1){ #未エントリー
$btn =<<"EOT";
$rcbt
EOT
}else{ #エントリー済み
$btn =<<"EOT";
×
EOT
}
#---------------------------------------------------------------
if($num_type < 10){
$out{'body'} .=<<"EOT";
$btn
EOT
$i++;
if ($i >= 5){
$out{'body'} .=<<"EOT";
EOT
$i = 0;
}
}else{ ##ボイスコンテスト
$comment_vw = $comment_v;
## $comment_vw =~ s/\,/ /g;
$out{'comment'} = '';
$out{'body'} .=<<"EOT";
EOT
}
}
### if ($out{'body'} eq ''){&err("$out{'pdname'}がない為、エントリーできません。");}
if ($out{'body'} eq ''){&err("対象イラストがない為、エントリーできません。");}
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){
$sql = "select c.pcid,c.name,c.icon,c.class from bonds a,bonds_meditate_master b,character c,(select pcid,count(*) as cnt from stars_data where pdid in ('G01','C14') group by pcid) d where a.pcid = '$pcid' and a.bonds_meditate = b.id and b.pan = 1 and a.target_pcid = c.pcid and c.pcid = d.pcid and d.cnt > 0 order by c.pcid;";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
foreach(@$ref) {
($tar_pcid,$tar_name,$tar_icon,$tar_class)=@{$_};
if ($tar_icon eq ''){$tar_icon = &def_icon($tar_class);}
$out{'body2'} .=<<"EOT";
$tar_name($tar_pcid)
EOT
}
}
&out_enc;
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){
#愛コン専用
&html_out("event_entry01_2.html");
}
else{
###&err($num_type);
if($num_type < 10){
##合わせ
if($num_type eq 2){
&html_out("event_entry01_2.html");
}else{
&html_out("event_entry01.html");
}
}else{
##アイコンリスト作成
$out{'icon_list'} ='';
##デフォルトアイコン取得
$sql2 = "select icon,class from character where pcid = '$pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($def_icon,$class)=@{$ref2->[0]};
$d_icon = &def_icon($class);
$i=0;
$sql = "select file_name,url from stars_data where pcid = '$pcid' and pdid in ('C02','C08') and crid != 'rexi' and state = 0 order by reg_date desc;";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
foreach(@$ref) {
($file_name,$url)=@{$_};
if ($i eq 0){
$out{'icon_list'} .=<<"EOT";
EOT
}
$out{'icon_list'} .=<<"EOT";
EOT
}else{
$out{'icon_list'} .=<<"EOT";
EOT
}
$i++;
if ($i > 7){
$out{'icon_list'} .=<<"EOT";
EOT
$i = 0;
}
}
if($out{'icon_list'} ne '' and $i ne 0){
$out{'icon_list'} .=<<"EOT";
EOT
}
$url = &def_icon($class);
$out{'icon_list'} .=<<"EOT";
EOT
&html_out("event_entry01_v.html");
}
}
}
#---------------------------------------
# 愛コンエントリー選択
# 相手のイラストを選ぶ
#---------------------------------------
sub entry_conf2 {
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
if ($in{'no'} eq ''){&err("開催回数が選択されていません。");}
if ($in{'tar_pcid'} eq ''){&err("相手キャラクターが選択されていません。");}
$sql = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-25 エラーが発生しました。");
($cnt)=@{$ref->[0]};
# if ($cnt ne '' && $cnt > 0){&err("エントリー済みの為、新たにエントリーできません。");}
if (length($in{'comment'}) > 60){&err("エントリーコメントは全角30字までです。");}
$out{'comment'} =~ s/</g;
$out{'comment'} =~ s/>/>/g;
#-- 相手の種族を得れるようにした。2013/03/01 KIYA
$i = 0;
if($uid eq "4210" or $in{'tar_pcid'} eq "xd0024"){
$sql = "select sd.file_name,sd.url,ch.race from stars_data sd left join character ch on sd.pcid = ch.pcid where sd.pcid = '$in{'tar_pcid'}' and sd.pdid in ('G01','C14') order by sd.reg_date desc;";
}else{
$sql = "select sd.file_name,sd.url,ch.race from stars_data sd left join character ch on sd.pcid = ch.pcid where sd.pcid = '$in{'tar_pcid'}' and sd.pdid in ('G01','C14') and sd.state = 0 order by sd.reg_date desc;";
}
$ref = $dbh->selectall_arrayref($sql) or &err("CODE-No.1501:エラーが発生しました。");
#--
foreach(@$ref) {
($file_name,$url,$race)=@{$_};
$sql2 = "select count(*) from contest_entry where (file_name = '$file_name' or file_name2 = '$file_name') and no = $in{'no'};";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE-No.1506:エラーが発生しました。");
($cnt)=@{$ref2->[0]};
if ($cnt > 0){
$flg = 0; #-- エントリー済み
}else{
$flg = 1; #-- 未エントリー
}
$th_url = "../../stars/data/gx_thumbnail/$file_name";
$w = 50;
$h = 100;
if (-e $th_url){
($format,$w,$h) = &GetImageSize($th_url);
}else{
$th_url = $url;
}
if ($i eq 0){
$out{'body'} .=<<"EOT";
EOT
}
if ($flg eq 1){ }else{$btn = '×';}
if($race eq 6){ #-- シフール対策
$url = "http://rexi.jp/stars/data/gx_shefool/$file_name";
$rcbt2 = " \n";
}else{
$rcbt2 = "";
}
$out{'body'} .=<<"EOT";
EOT
$i++;
if ($i >= 5){
$out{'body'} .=<<"EOT";
EOT
$i = 0;
}
}
foreach $key ( keys %in ) {
if ($key ne 'x' && $key ne 'mode' && $key ne 'y'){
$out{'hidden'} .=<<"EOT";
EOT
}
}
&html_out("event_entry01_2_02.html");
}
#---------------------------------------
# エントリー合わせ図確認
#---------------------------------------
sub entry_conf3 {
$dat_file1 = '/home/rexi-jp/public_html/' . substr($in{'con_entry'},15);
($format1,$w1,$h1) = &GetImageSize($dat_file1);
$dat_file2 = '/home/rexi-jp/public_html/' . substr($in{'con_entry2'},15);
($format2,$w2,$h2) = &GetImageSize($dat_file2);
# &err("[$dat_file1],[$dat_file2]");
if ($w1 > 300 && $w2 > 300){&err("2つとも横幅300ピクセルを超えるイラストを指定することはできません。");}
#if($uid eq 2){&err("$w1,$h1,$w2,$h2");}
if ($w2 <= 300){
$out{'ptn1'}=<<"EOT";
パターン1
パターン2
EOT
}
if ($w1 <= 300){
$out{'ptn1'}.=<<"EOT";
パターン3
パターン4
EOT
}
$out{'w1'} = $w1;
$out{'h1'} = $h1;
$out{'w2'} = $w2;
$out{'h2'} = $h2;
foreach $key ( keys %in ) {
if ($key ne 'x' && $key ne 'mode' && $key ne 'y'){
$out{'hidden'} .=<<"EOT";
EOT
}
}
&html_out("event_entry01_2_03.html");
}
#---------------------------------------
# エントリー確認
#---------------------------------------
sub entry_conf4 {
if ($in{'ptn'} eq ''){&err("パターンが選択されていません。");}
$sql = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-26 エラーが発生しました。");
($cnt)=@{$ref->[0]};
if ($cnt ne '' && $cnt > 0 && $in{'no'} ne 7 && $in{'no'} ne 10 && $in{'no'} ne 15 && $in{'no'} ne 25 && $in{'no'} ne 36){&err("エントリー済みの為、新たにエントリーできません。");}
$sql = "select name from character where pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-27 エラーが発生しました。");
($out{'pcname1'})=@{$ref->[0]};
$sql = "select name from character where pcid = '$in{'tar_pcid'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-28 エラーが発生しました。");
($out{'pcname2'})=@{$ref->[0]};
#-- 自分のイラストが合ってるかチェック
#-- シフール用にURL退避
#$shefool_url_back = $in{'con_entry'};
#-- エラー回避のためURLを元に戻す
if($in{'race'} eq 6 ){ $in{'con_entry'} =~ s/\/gx_shefool\//\/gx\//g; }
if($uid eq "4210"){
$sql = "select sd.file_name,sd.url,ch.race from stars_data sd left join character ch on sd.pcid = ch.pcid where sd.pcid = '$pcid' $where and sd.url = '$in{'con_entry'}';";
}else{
$sql = "select sd.file_name,sd.url,ch.race from stars_data sd left join character ch on sd.pcid = ch.pcid where sd.pcid = '$pcid' $where and sd.url = '$in{'con_entry'}' and sd.state = 0;";
}
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-29 エラーが発生しました。");
($file_name,$url,$race)=@{$ref->[0]};
if ($file_name eq ''){ &err("CODE:S-1650[$pcid]指定されたイラストは現在ログインされているキャラクターのイラストではありません。"); }
#-- 相手のイラストが合ってるかチェック
#-- シフール用にURL退避
#$shefool_url_back2 = $in{'con_entry2'};
#-- エラー回避のためURLを元に戻す
if($in{'race2'} eq 6 ){ $in{'con_entry2'} =~ s/\/gx_shefool\//\/gx\//g; }
if($in{'tar_pcid'} eq "xd0024"){
$sql = "select sd.file_name,sd.url,ch.race from stars_data sd left join character ch on sd.pcid = ch.pcid where sd.pcid = '$in{'tar_pcid'}' $where and sd.url = '$in{'con_entry2'}';";
}else{
$sql = "select sd.file_name,sd.url,ch.race from stars_data sd left join character ch on sd.pcid = ch.pcid where sd.pcid = '$in{'tar_pcid'}' $where and sd.url = '$in{'con_entry2'}' and sd.state = 0;";
}
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-30 エラーが発生しました。");
($file_name2,$url2,$race2)=@{$ref->[0]};
if ($file_name2 eq ''){ &err("指定されたイラストは相手のキャラクターのイラストではありません。"); }
#----
if(($in{'no'} eq 36 || $in{'no'} eq 37) && $in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx\//\/gx_shefool\//g; } #-- 自分がシフール
$dat_file1 = '/home/rexi-jp/public_html/' . substr($in{'con_entry'},15);
($format1,$w1,$h1) = &GetImageSize($dat_file1);
if(($in{'no'} eq 36 || $in{'no'} eq 37) && $in{'race2'} eq 6){$in{'con_entry2'} =~ s/\/gx\//\/gx_shefool\//g; } #-- 相手がシフール
$dat_file2 = '/home/rexi-jp/public_html/' . substr($in{'con_entry2'},15);
($format2,$w2,$h2) = &GetImageSize($dat_file2);
#----
if ($in{'ptn'} eq 1){
$out{'body'}=<<"EOT";
EOT
}
elsif ($in{'ptn'} eq 2){
$out{'body'}=<<"EOT";
EOT
}
elsif ($in{'ptn'} eq 3){
$out{'body'}=<<"EOT";
EOT
}
elsif ($in{'ptn'} eq 4){
$out{'body'}=<<"EOT";
EOT
}
foreach $key ( keys %in ) {
if ($key ne 'x' && $key ne 'mode' && $key ne 'y'){
$out{'hidden'} .=<<"EOT";
EOT
}
}
&html_out("event_entry01_2_04.html");
}
#---------------------------------------
# エントリー確認
#---------------------------------------
sub entry_conf {
# if ($uid eq 1717) { $pcid = 'xb3378'; } #梶浦スペシャル
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
if ($in{'no'} eq ''){&err("開催回数が選択されていません。");}
# if ($in{'no'} eq 2){
# if ("$g_year$g_mon$g_mday$g_hour$g_min" < "200909180000" || "$g_year$g_mon$g_mday$g_hour$g_min" > "200909292200"){&err("エントリー期間でない為、利用できません。");}
# }
if ($in{'no'} eq 4 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 5 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 21 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 22 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if($num_type eq 10){
if ($in{'con_entry'} eq ''){&err("ボイスが指定されていません。");}
if ($in{'icon_entry'} eq ''){&err("アイコンが指定されていません。");}
}
$sql = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$pcid'";
if ($in{'type'} ne '' && $in{'type'} > 0){$sql .= " and type = $in{'type'}";}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-ENT-01 エラーが発生しました。");
($cnt)=@{$ref->[0]};
if ($cnt ne '' && $cnt > 0 && $in{'no'} ne 7 && $in{'no'} ne 14 && $in{'no'} ne 15 && $in{'no'} ne 20 && $in{'no'} ne 36 && $num_type ne 2){
&err("エントリー済みの為、新たにエントリーできません。");
}
if (length($in{'comment'}) > 60){&err("エントリーコメントは全角30字までです。");}
if (($in{'no'} eq 4 && $in{'type'} eq 3) or ($in{'no'} eq 13 && $in{'type'} eq 5) or ($in{'no'} eq 22 && $in{'type'} eq 3)){
$where = "and pdid in ('C02','C08')";
}elsif ($in{'no'} eq 4 && $in{'type'} > 0){
$where = "and pdid in ('G01','C14')";
}elsif ($in{'no'} eq 6){
$where = "and pdid = 'C05'";
}elsif ($in{'no'} eq 13){
if ($in{'type'} eq 3 or $in{'type'} eq 4){
$where = "and pdid = 'G04'";
}elsif ($in{'type'} eq 5){
$where = "and pdid = 'C02'";
}
}elsif ($in{'no'} eq 21){
if ($in{'type'} ne 4 ){
$where = "and pdid in ('G01','C14')";
}elsif ($in{'type'} eq 4 ){
$where = "and pdid = 'C10'";
}
}elsif ($in{'no'} eq 22){
$where = "and pdid in ('G01','C14')";
## }elsif ($in{'no'} eq 24){
## $where = "and pdid in ('C04','C05')";
}elsif($num_type eq 10){ ##ショートボイス
$where = "and pdid in ('V01')";
}elsif($num_type eq 4){ ##ショートボイス
$where = "and pdid in ('G04')";
}elsif ($in{'no'} >= 1){
$where = "and pdid in ('G01','C02','C08','C16','C14','C04','C05')";
}
#-- シフール対策
if($in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx_shefool\//\/gx\//g; }
$sql = "select file_name,url,comment from stars_data where pcid = '$pcid' $where and url = '$in{'con_entry'}' and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-31 エラーが発生しました。");
($file_name,$url,$comment)=@{$ref->[0]};
if ($file_name eq ''){&err("ログインキャラクターが正しくありません。");}
if($num_type < 10){
$out{'zensin'} = $url;
($format,$out{'w'},$out{'h'}) = &GetImageSize("/home/rexi-jp/public_html/stars/data/$file_name");
### my $image = Image::Magick->new;
### $image->Read("http://rexi.jp/stars/data/$file_name");
### my ($now_width, $now_height) = $image->Get('width', 'height');
### $out{'w'} = $now_width;
### $out{'h'} = $now_height;
if($out{'w'} > 0){
$out{'w'} = "WIDTH=$out{'w'}";
}else{
$out{'w'} = '';
}
if($out{'h'} > 0){
$out{'h'} = "HEIGHT=$out{'h'}";
}else{
$out{'h'} = '';
}
&out_enc;
&html_out("event_entry02.html");
}else{ ##ボイス
$out{'voice'} =<<"EOT";
EOT
$out{'url'} = $url;
$out{'icon'} = $in{'icon_entry'};
## $comment =~ s/\,/ /g;
$out{'comment'} = $comment;
&out_enc;
&html_out("event_entry02_v.html");
}
}
#---------------------------------------
# ミスコンエントリー実行
#---------------------------------------
sub entry_exe {
if ($uid eq 4210) {$pcid = 'xd0024';}
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
if ($in{'no'} eq ''){&err("開催回数が選択されていません。");}
if ($in{'no'} eq 2){
# if ("$g_year$g_mon$g_mday$g_hour$g_min" < "200909180000" || "$g_year$g_mon$g_mday$g_hour$g_min" > "200909292200"){&err("エントリー期間でない為、利用できません。");}
}
if ($in{'no'} eq 4 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 5 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 21 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
if ($in{'no'} eq 22 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
$sql = "select count(*) from contest_entry where no = $in{'no'} and pcid = '$pcid'";
if ($in{'type'} ne '' && $in{'type'} > 0){$sql .= " and type = $in{'type'}";}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-32 エラーが発生しました。");
($cnt)=@{$ref->[0]};
if ($cnt ne '' && $cnt > 0 && $in{'no'} ne 7 && $in{'no'} ne 14 && $in{'no'} ne 15 && $in{'no'} ne 20 && $in{'no'} ne 36 && $num_type ne 2){&err("エントリー済みの為、新たにエントリーできません。");}
if($num_type < 10){
if (length($in{'comment'}) > 60){&err("エントリーコメントは全角30字までです。");}
}
if ($in{'no'} eq 1){
$where = "and pdid = 'G01'";
}
#-- シフール対策の為、URLを元に戻す
if($in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx_shefool\//\/gx\//g; }
if($in{'race2'} eq 6){ $in{'con_entry2'} =~ s/\/gx_shefool\//\/gx\//g; }
if ($in{'url'} eq ''){$in{'url'} = $in{'con_entry'};}
if($pcid eq "xd0024"){
$sql = "select file_name,url from stars_data where pcid = '$pcid' $where and url = '$in{'url'}';";
}else{
$sql = "select file_name,url from stars_data where pcid = '$pcid' $where and url = '$in{'url'}' and state = 0;";
}
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-33 エラーが発生しました。");
($file_name,$url)=@{$ref->[0]};
if ($file_name eq ''){&err("CODE-No.1890:ログインキャラクターが正しくありません。");}
#--
$sql = "select name,race,class,birth,sex,lumina,standpoint from character where pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
($name,$race,$class,$birth,$sex,$lumina,$standpoint)=@{$ref->[0]};
if ($in{'type'} eq ''){$in{'type'} = 0;}
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){
use Image::Magick;
use File::Basename;
use File::Copy;
#合成処理
$sql = "select file_name from stars_data where url = '$in{'con_entry'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
($fname)=@{$ref->[0]};
#-- シフール対策のため、URLをシフール用に変更
if($in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx\//\/gx_shefool\//g; }
if($in{'race2'} eq 6){ $in{'con_entry2'} =~ s/\/gx\//\/gx_shefool\//g; }
$m_file = '/home/rexi-jp/public_html/' . substr($in{'con_entry'},15);
$s_file = '/home/rexi-jp/public_html/' . substr($in{'con_entry2'},15);
$o_file = '/home/rexi-jp/public_html/gx/event/con_image/' . $pcid . '_' . $in{'tar_pcid'} . '_' . $fname;
$t_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . $pcid . '_' . $in{'tar_pcid'} . '_' . $fname;
$tmp = "/home/rexi-jp/public_html/gx/event/con_image/tmp_" . $pcid . '_' . $in{'tar_pcid'} . '_' . $fname;
# 画像を合成する
$back_png = '/home/rexi-jp/public_html/gx/event/png_back.png';
my $image = Image::Magick->new;
$image->Read($back_png);
if ($in{'ptn'} eq 1){
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>150, y=>0);
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>0, y=>0);
}
elsif ($in{'ptn'} eq 2){
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>0, y=>0);
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>150, y=>0);
}
elsif ($in{'ptn'} eq 3){
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>0, y=>0);
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>150, y=>0);
}
elsif ($in{'ptn'} eq 4){
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>150, y=>0);
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>0, y=>0);
}
if ($image ne ''){
$image->Write($o_file);
# $image->Write("png:$o_file");
if (!-e $o_file){&err("画像合成に失敗しました。");}
system "convert -resize x400 +profile iptc -quality 100 $o_file $t_file";
}
#-- シフール対策のため、URLを元に戻す
if($in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx_shefool\//\/gx\//g; }
if($in{'race2'} eq 6){ $in{'con_entry2'} =~ s/\/gx_shefool\//\/gx\//g; }
if($in{'tar_pcid'} eq "xd0024"){
$sql = "select file_name,url from stars_data where pcid = '$in{'tar_pcid'}' and url = '$in{'con_entry2'}';";
}else{
$sql = "select file_name,url from stars_data where pcid = '$in{'tar_pcid'}' and url = '$in{'con_entry2'}' and state = 0;";
}
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-34 エラーが発生しました。");
($file2,$url)=@{$ref->[0]};
if ($file2 eq ''){&err("指定されたイラストは相手キャラクターのイラストではありません。");}
#-- シフール対策のため、URLをシフール用に変換
if($in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx\//\/gx_shefool\//g; }
if($in{'race2'} eq 6){ $in{'con_entry2'} =~ s/\/gx\//\/gx_shefool\//g; }
$sql = "insert into contest_entry (no,pcid,name,race,class,birth,sex,lumina,file_name,url,standpoint,comment,type,tar_pcid,file_name2,url2,ptn,agreement) values ($in{'no'},'$pcid','$name',$race,$class,$birth,$sex,$lumina,'$file_name','$in{'con_entry'}',$standpoint,'$in{'comment'}',$in{'type'},'$in{'tar_pcid'}','$file2','$in{'con_entry2'}',$in{'ptn'},0);";
## }elsif($in{'no'} eq 21 && $in{'type'} eq 4){
## use Image::Magick;
## use File::Basename;
## use File::Copy;
## $o_file = '/home/rexi-jp/public_html/gx/event/con_image/' . '21_4'.$file_name;
## $t_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . '21_4'.$file_name;
## # 画像をカットする
## $back_png = '/home/rexi-jp/public_html/gx/event/png_back.png';
## my $image = Image::Magick->new;
## $sql = "insert into contest_entry (no,pcid,name,race,class,birth,sex,lumina,file_name,url,standpoint,comment,type) values ($in{'no'},'$pcid','$name',$race,$class,$birth,$sex,$lumina,'$file_name','$url',$standpoint,'$in{'comment'}',$in{'type'});";
##
}else{
# if($in{'race'} eq 6){ $in{'con_entry'} =~ s/\/gx\//\/gx_shefool\//g; }
# if($in{'race2'} eq 6){ $in{'con_entry2'} =~ s/\/gx\//\/gx_shefool\//g; }
if($num_type < 10){
$sql = "insert into contest_entry (no,pcid,name,race,class,birth,sex,lumina,file_name,url,standpoint,comment,type) values ($in{'no'},'$pcid','$name',$race,$class,$birth,$sex,$lumina,'$file_name','$in{'url'}',$standpoint,'$in{'comment'}',$in{'type'});";
}else{
$sql = "select file_name,url from stars_data where pcid = '$pcid' and url = '$in{'icon'}' and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-35 エラーが発生しました。");
($file2,$url)=@{$ref->[0]};
$sql = "insert into contest_entry (no,pcid,name,race,class,birth,sex,lumina,file_name,url,standpoint,comment,type,tar_pcid,file_name2,url2) values ($in{'no'},'$pcid','$name',$race,$class,$birth,$sex,$lumina,'$file_name','$in{'url'}',$standpoint,'$in{'comment'}',$in{'type'},'$in{'tar_pcid'}','$file2','$in{'icon'}');";
}
}
if ($uid eq 2){$dbg = $sql;}
$dbh->do($sql) or &err("CODE:RE-04 エラーが発生しました。 $dbg $sql");
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){
#同意確認
$sql = "select name,uid from character where pcid = '$in{'tar_pcid'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-36 エラーが発生しました。");
($tar_pcname,$tar_uid)=@{$ref->[0]};
$dbh_pl = &connectDB($plDB);
$sql = "select name,mail from userdat where seq = $tar_uid;";
$ref = $dbh_pl->selectall_arrayref($sql) or &err("CODE:S-37 エラーが発生しました。");
($pl_name,$pl_mail)=@{$ref->[0]};
&disconDB($dbh_pl);
$mailbody =<<"EOT";
$pl_name 様
お世話になっております、REXiです。
お客様のキャラクター「$tar_pcname($in{'tar_pcid'})」に、「$name($pcid)」から$out{'title'}のエントリー申し込みがありました。
下記URLからこの申請の可否を行ってください。
http://rexi.jp/gx/event/event.cgi?mode=admission&no=$in{'no'}&tar_pcid=$in{'tar_pcid'}&apply_pcid=$pcid&fname=$fname
今後とも、よろしくお願いします。
$mailfooter
EOT
&sendmail($pl_mail,'gx@rexi.jp',"【GX】$in{'tar_pcid'}:$out{'title'}エントリー申請",$mailbody);
}
print "Location: ./event_entry_end.html\n\n";
}
#---------------------------------------
#
#---------------------------------------
sub admission {
&date_rtn;
if ($in{'no'} eq ''){
$in{'no'} = 7;
$out{'no'} = 7;
}
if ($pcid ne $in{'tar_pcid'} && $uid ne 2){&err("ログインされているキャラクターと申請を受けたキャラクターが一致しません。");}
if ($in{'tar_pcid'} eq '' || $in{'apply_pcid'} eq ''){&err("パラメーターが不正です。");}
$sql = "select name,comment,type from contest_entry where no = $in{'no'} and pcid = '$in{'apply_pcid'}' and tar_pcid = '$in{'tar_pcid'}' and (agreement is null or agreement = 0) and file_name = '$in{'fname'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
($out{'apply_name'},$out{'comment'},$type)=@{$ref->[0]};
$out{'image'} = 'http://rexi.jp/gx/event/con_image/' . $in{'apply_pcid'} . '_' . $in{'tar_pcid'} . '_' . $in{'fname'};
if ($in{'no'} eq 7 || $in{'no'} eq 15){
$out{'title'} = '愛コン';
if ($type eq 1){$out{'title'} .= 'ベストカップル部門';}
if ($type eq 2){$out{'title'} .= 'ベストパートナー部門';}
if ($type eq 3){$out{'title'} .= 'ベストファンタジー部門';}
}
elsif ($in{'no'} eq 10){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201006212200"){&err("エントリー期間を過ぎています。");}
$out{'title'} = 'ユニコン';
if ($type eq 1){$out{'title'} .= '運動着部門';}
if ($type eq 2){$out{'title'} .= 'スクール水着部門';}
}
elsif ($in{'no'} eq 20){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201109010000"){&err("エントリー期間を過ぎています。");}
$out{'title'} = 'ダンスコン';
}
&html_out("event_admission01.html");
}
#---------------------------------------
#
#---------------------------------------
sub admission_exe {
if ($in{'mode2'} eq 1){
#承認
$out{'res'} = '承認';
$sql = "update contest_entry set agreement = 1,reg_date = now() where no = $in{'no'} and pcid = '$in{'apply_pcid'}' and tar_pcid = '$in{'tar_pcid'}' and (agreement is null or agreement = 0) and file_name = '$in{'fname'}';";
}
else{
#却下
$out{'res'} = '却下';
$sql = "delete from contest_entry where no = $in{'no'} and pcid = '$in{'apply_pcid'}' and tar_pcid = '$in{'tar_pcid'}' and (agreement is null or agreement = 0) and file_name = '$in{'fname'}';";
}
$dbh->do($sql) or &err("CODE:RE-04 エラーが発生しました。");
$sql = "select name,uid from character where pcid = '$in{'apply_pcid'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-38 エラーが発生しました。");
($ap_pcname,$ap_uid)=@{$ref->[0]};
$dbh_pl = &connectDB($plDB);
$sql = "select name,mail from userdat where seq = $ap_uid;";
$ref = $dbh_pl->selectall_arrayref($sql) or &err("CODE:S-39 エラーが発生しました。");
($pl_name,$pl_mail)=@{$ref->[0]};
&disconDB($dbh_pl);
$sql = "select name from character where pcid = '$in{'tar_pcid'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-40 エラーが発生しました。");
($tar_pcname)=@{$ref->[0]};
$mailbody =<<"EOT";
$pl_name 様
お世話になっております、REXiです。
お客様のキャラクター「$ap_pcname($in{'apply_pcid'})」が「$tar_pcname($in{'tar_pcid'})」に申請された$out{'title'}のエントリーですが、$out{'res'}されました。
今後とも、よろしくお願いします。
$mailfooter
EOT
&sendmail($pl_mail,'gx@rexi.jp',"【GX】$in{'apply_pcid'}:$out{'title'}エントリー$out{'res'}",$mailbody);
&html_out("event_admission02.html");
}
#---------------------------------------
# エントリー一覧
#---------------------------------------
sub list {
if ($in{'no'} eq ''){&err("開催回数が選択されていません。");}
if ($in{'no'} eq 4 && $in{'type'} eq ''){&err("エントリータイプが指定されていません。");}
$i1 = 0;
$i2 = 0;
$i = 0;
$right_max = 4;
$sql = "select pcid,name,race,class,birth,sex,lumina,file_name,url,standpoint,comment,tar_pcid,url2 from contest_entry where no = $in{'no'} and (agreement is null or agreement = 1)";
if ($in{'type'} ne '' && $in{'type'} > 0){$sql .= " and type = $in{'type'}";}
$sql .= " order by reg_date;";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
foreach(@$ref) {
($epcid,$ename,$race,$class,$birth,$sex,$lumina,$file_name,$url,$standpoint,$comment,$tar_pcid,$url2 )=@{$_};
$comment =~ s/</g;
$comment =~ s/>/>/g;
$subpc = '';
$th_url = "../../stars/data/gx_thumbnail/$file_name";
$ma_url = "../../stars/data/gx/$file_name";
if ($tar_pcid ne ''){
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。");
($tar_name)=@{$ref2->[0]};
}
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){
$right_max = 2;
$th_url = "./con_thumbnail/" . $epcid . '_' . $tar_pcid . '_' . $file_name;
$ma_url = './con_image/' . $epcid . '_' . $tar_pcid . '_' . $file_name;
$url = $th_url;
$subpc = " $tar_name($tar_pcid )";
}
if ($in{'no'} eq 1){
$bdn = 'body' . $sex;
if ($sex eq 1 && $i1 eq 0){
$out{'body1'} .=<<"EOT";
EOT
}
if ($sex eq 2 && $i2 eq 0){
$out{'body2'} .=<<"EOT";
EOT
}
}
else{
$bdn = 'body';
if ($i eq 0){
$out{$bdn} .=<<"EOT";
EOT
}
}
if (!-e $th_url){$th_url = $ma_url;}
($format,$width,$height) = &GetImageSize($th_url);
if ($width < 100){
$font1 = '';
$font2 = ' ';
$br1 = ' ';
}
else{
$font1 = '';
$font2 = '';
$br1 = '';
}
if($num_type < 10){
$out{$bdn} .=<<"EOT";
$font1$ename$br1($epcid )$subpc$font2
@standpoint_str[$standpoint]
@class_str[$class]
$comment
EOT
}else{ ##ボイス
$out{$bdn} .=<<"EOT";
$font1$ename$br1($epcid )$subpc$font2
@standpoint_str[$standpoint]
@class_str[$class]
$comment
EOT
}
if ($in{'mode2'} eq 'all'){
if ($in{'no'} eq 1){
$bdn = 'list' . $sex;
}
else{$bdn = 'list';}
# ($format,$width,$height) = &GetImageSize("/home/rexi-jp/public_html/stars/data/gx/$file_name");
if($num_type < 10){
($format,$width,$height) = &GetImageSize($ma_url);
$out{$bdn} .=<<"EOT";
$font1$ename($epcid )$subpc$font2
@standpoint_str[$standpoint]
@class_str[$class]
$comment
EOT
}else{ ##ボイス
$out{$bdn} .=<<"EOT";
$font1$ename($epcid )$subpc$font2
@standpoint_str[$standpoint]
@class_str[$class]
$comment
EOT
}
}
if ($sex eq 1){$i1++;}
elsif ($sex eq 2){$i2++;}
$i++;
if ($in{'no'} eq 1){
if ($sex eq 1 && $i1 >= $right_max){
$out{'body1'} .=<<"EOT";
EOT
$i1 = 0;
}
elsif ($sex eq 2 && $i2 >= $right_max){
$out{'body2'} .=<<"EOT";
EOT
$i2 = 0;
}
}
else{
if ($i >= $right_max){
$out{'body'} .=<<"EOT";
EOT
$i = 0;
}
}
}
if ($in{'no'} eq 5){
$dbh_jj = &connectDB('jj');
@attribute_str = ('―','Justice','Joker');
@class_str2 = ('','特殊スーツ','改造人間','改造人間','改造人間','超能力者','エキスパート',,'ペルソナ',,'不明','人造人間(ヒト型)','人造人間(メカ型)');
$sql2 = "select pcid,name2 || '/' || name1,class,birth,sex,attribute,file_name,url,comment from contest_entry where no = 1";
if ($in{'type'} ne '' && $in{'type'} > 0){$sql2 .= " and type = $in{'type'}";}
$sql2 .= " order by reg_date;";
$ref2 = $dbh_jj->selectall_arrayref($sql2) or &err("エラーが発生しました。");
foreach(@$ref2) {
($epcid,$ename,$class,undef,$sex,$attribute,$file_name,$url,$comment)=@{$_};
$th_url = "../../stars/data/jj_thumbnail/$file_name";
$ma_url = "../../stars/data/jj/$file_name";
$bdn = 'body';
if ($i eq 0){
$out{$bdn} .=<<"EOT";
EOT
}
if (!-e $th_url){$th_url = $ma_url;}
($format,$width,$height) = &GetImageSize($th_url);
$out{$bdn} .=<<"EOT";
$epcid
$ename
@attribute_str[$attribute]
@class_str2[$class]
$comment
EOT
if ($in{'mode2'} eq 'all'){
$bdn = 'list';
($format,$width,$height) = &GetImageSize("/home/rexi-jp/public_html/stars/data/jj/$file_name");
$out{$bdn} .=<<"EOT";
$epcid
$ename
@attribute_str[$attribute]
@class_str2[$class]
$comment
EOT
}
if ($sex eq 1){$i1++;}
elsif ($sex eq 2){$i2++;}
$i++;
if ($i >= $right_max){
$out{'body'} .=<<"EOT";
EOT
$i = 0;
}
}
&disconDB($dbh_jj);
}
if ($in{'mode2'} eq 'all' && $in{'no'} eq 1){$out{'list'} = $out{'list' . $in{'type'}};}
if ($in{'no'} eq 1){
if ($in{'mode2'} eq ''){$htmlfile = 'event_entry_list.html';}
elsif ($in{'mode2'} eq 'all'){
$htmlfile = 'event_entry_list2.html';
if ($in{'type'} eq 1){$out{'title'} = '夏男';}
elsif ($in{'type'} eq 2){$out{'title'} = '夏娘';}
}
}
else{
if ($in{'mode2'} eq ''){$htmlfile = 'event_entry_deflist.html';}
elsif ($in{'mode2'} eq 'all'){
$htmlfile = 'event_entry_list2.html';
}
}
&out_enc;
&html_out($htmlfile);
}
#---------------------------------------
# 投票一覧
#---------------------------------------
sub poll_list {
if ($in{'no'} eq 0){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200908172400"){&err("投票期間を過ぎています。");}
$html_file = "event_poll01.html";
}
elsif ($in{'no'} eq 1){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200908261500"){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_xh01.html";
}
elsif ($in{'no'} eq 2){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200910062000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_xh02.html";
}
elsif ($in{'no'} eq 3){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200911052000" && $uid ne 2){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_xh03.html";
$sql = "select a.text1,a.pcid,b.name,a.target,a.text2 from event_poll a,character b where a.no = $in{'no'} and a.pcid = b.pcid order by a.reg_date;";
$ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。");
foreach(@$ref) {
($daime,$p_pcid,$p_name,$p_target,$p_text2)=@{$_};
# $cast = ' ';
$cast = '';
if ($uid eq 2){
@a = ();
@a = split(/\,/,$p_target);
foreach(@a){
$tmp = $_;
if ($tmp ne ':'){
@b = ();
@b = split(/\:/,$tmp);
$sql2 = "select name from character where pcid = '@b[0]';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-41 エラーが発生しました。");
($cast_name)=@{$ref2->[0]};
$cast .=<<"EOT";
\t\t$cast_name\t(@b[0])\t@b[1]
EOT
$cast_name{@b[0]} = $cast_name;
$cast_total{@b[0]}++;
}
}
}
$out{'posting'} .=<<"EOT";
$daime/$p_name($p_pcid)$cast
EOT
# $p_text2 = &newline_change($p_text2);
chomp $cast;
$datastr .=<<"EOT";
$daime
"$p_text2"
$cast
$p_name($p_pcid)
EOT
}
if ($in{'mode_dbg'} eq 1){
foreach $key (sort { $cast_total{$b} <=> $cast_total{$a} } keys %cast_total){
$data .=<<"EOT";
$cast_total{$key}:$cast_name{$key}($key)
EOT
}
&err($data);
}
elsif ($in{'mode_dbg'} eq 2){
&text_err($datastr);
}
}
elsif ($in{'no'} eq 4){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200911300000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_xh04.html";
}
elsif ($in{'no'} eq 5){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201001060000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_xh05.html";
}
elsif ($in{'no'} eq 6){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201002230000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_xh06.html";
}
elsif ($in{'no'} eq 7){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_con07.html";
}
elsif ($in{'no'} eq 8){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_con08.html";
}
elsif ($in{'no'} eq 9){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_chairperson2.html";
}
elsif ($in{'no'} eq 10){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_con10.html";
}
elsif ($in{'no'} eq 17){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll01_chairperson3.html";
}
elsif ($num_type >= 10){ ##ボイス
##if($uid ne 1717){
if($uid ne 1717 && $uid ne 535){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。");}
}
if($pol_sheet eq 0){
$html_file = "event_poll01_con_v.html";
}else{
$html_file = "event_poll01_con" . $in{'no'} . ".html";
}
$out{'ent_yy'}='1'.substr($adm_date,1,3);
$out{'ent_mm'}=substr($adm_date,4,2);
$out{'ent_dd'}=substr($adm_date,6,2);
}
elsif ($in{'no'} >= 23){
##if($uid ne 1717){
if($uid ne 1717 && $uid ne 535){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。");}
}
if($pol_sheet eq 0){ ##汎用/専用
if($in{'no'} ne 33){
$html_file = "event_poll01_con_n.html";
}else{
$html_file = "event_poll01_con33.html";
}
}else{
$html_file = "event_poll01_con" . $in{'no'} . ".html";
}
$out{'ent_yy'}='1'.substr($adm_date,1,3);
$out{'ent_mm'}=substr($adm_date,4,2);
$out{'ent_dd'}=substr($adm_date,6,2);
}
else{
if($uid ne 1717 && $uid ne 535){
##if($uid ne 1717){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。");}
}
$html_file = "event_poll01_con" . $in{'no'} . ".html";
$out{'ent_yy'}='1'.substr($adm_date,1,3);
$out{'ent_mm'}=substr($adm_date,4,2);
$out{'ent_dd'}=substr($adm_date,6,2);
}
# else{&err("不正なパラメーター");}
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
##エントリー情報取得
$sql = "select pcid,name,race,class,birth,sex,lumina,file_name,url,standpoint,comment,type,tar_pcid,url2 from contest_entry where no = $in{'no'}";
if ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){$sql .= " and agreement = 1";}
$sql .= " order by reg_date;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:P-01 エラーが発生しました。");
foreach(@$ref) {
($epcid,$ename,$race,$class,$birth,$sex,$lumina,$file_name,$url,$standpoint,$comment,$type,$tar_pcid,$url2)=@{$_};
$th_url = "../../stars/data/gx_thumbnail/$file_name";
$ma_url = "../../stars/data/gx/$file_name";
if ($in{'no'} eq 1){ ##過去
$bdn = 'body' . $sex;
if ($sex eq 1 && $i1 eq 0){
$out{'body1'} .=<<"EOT";
EOT
}
if ($sex eq 2 && $i2 eq 0){
$out{'body2'} .=<<"EOT";
EOT
}
##
$out{$bdn} .=<<"EOT";
EOT
if ($sex eq 1){$i1++;}
elsif ($sex eq 2){$i2++;}
if ($sex eq 1 && $i1 >= 4){
$out{'body1'} .=<<"EOT";
EOT
$i1 = 0;
}
elsif ($sex eq 2 && $i2 >= 4){
$out{'body2'} .=<<"EOT";
EOT
$i2 = 0;
}
}
elsif ($in{'no'} eq 4 || $in{'no'} eq 5 || $in{'no'} eq 8 || $in{'no'} eq 11 || $in{'no'} eq 12 ){ ##過去
$hname1 = 'list' . $type;
$hname2 = 'ary' . $type;
$out{$hname1} .=<<"EOT";
$ename($epcid)
EOT
$out{$hname2} .= "\"$file_name\",";
if ($in{'no'} eq 13 && ($type eq 1 || $type eq 2)){
$out{'list6'} .=<<"EOT";
$ename($epcid)
EOT
$out{'ary6'} .= "\"$file_name\",";
}
}
elsif ($in{'no'} eq 13){
$hname1 = 'list' . $type;
$hname2 = 'ary' . $type;
$out{$hname1} .=<<"EOT";
$ename($epcid)
EOT
$out{$hname2} .= "\"$file_name\",";
if ($type eq 1 || $type eq 2){
$out{'list6'} .=<<"EOT";
$ename($epcid)
EOT
$out{'ary6'} .= "\"$file_name\",";
}
}
elsif ($in{'no'} eq 6){ ##過去
$sql2 = "select a.plural_pcid,b.name from stars_data a,character b where a.file_name = '$file_name' and a.plural_pcid = b.pcid;";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-42 エラーが発生しました。");
($plural_pcid,$plural_name)=@{$ref2->[0]};
$out{'list'} .=<<"EOT";
$ename($epcid)&$plural_name($plural_pcid)
EOT
$out{'ary'} .= "\"$file_name\",";
}
elsif ($in{'no'} eq 7 || $in{'no'} eq 10 || $in{'no'} eq 15 || $in{'no'} eq 20 || $num_type eq 2){ ##過去
$hname1 = 'list' . $type;
$hname2 = 'ary' . $type;
$th_url = $epcid . '_' . $tar_pcid . '_' . $file_name;
$ma_url = 'con_image/' . $epcid . '_' . $tar_pcid . '_' . $file_name;
$sql2 = "select name from character where pcid = '$tar_pcid';";
$ref2 = $dbh->selectall_arrayref($sql2) or &err("CODE:S-43 エラーが発生しました。");
($plural_name)=@{$ref2->[0]};
$out{$hname1} .=<<"EOT";
$ename($epcid)&$plural_name($tar_pcid)
EOT
$out{$hname2} .= "\"$th_url\",";
}
else{
$hname1 = 'list' . $type;
$hname2 = 'ary' . $type;
##リスト項目
if($num_type < 10){
$out{$hname1} .=<<"EOT";
$ename($epcid)
EOT
$out{$hname2} .= "\"$file_name\",";
# $out{'list'} .=<<"EOT";
# $ename($epcid)
#EOT
$out{'ary'} .= "\"$file_name\",";
}else{
$hname3 = 'ary' . $type . '_2';
$hname4 = 'ary' . $type . '_3';
$hname5 = 'ary' . $type . '_4';
$out{$hname1} .=<<"EOT";
$ename($epcid)
EOT
$out{'ary'} .= "\"$file_name\",";
$out{$hname2} .= "\"$url2\",";
$out{$hname3} .= "\"$url\",";
$out{$hname4} .= "\"$comment\",";
$comment =~ s/\,/ /g;
$out{$hname5} .= "\"$comment\",";
## $out{$hname2} .= <<"EOT";
##
##
##
##
##
##
##
##
##EOT
######## $out{'ary_v'} .= "\"$file_name\",";
}
if ($in{'no'} eq 33){ ##混合部門有
##全部追加
if(($type eq 1) or ($type eq 2)){
$hname1 = 'list5';
$hname2 = 'ary5';
## $out{$hname1} .=<<"EOT";
## $ename($epcid)
##EOT
### $out{$hname2} .= "\"$file_name\",";
$out{'ary'} .= "\"$file_name\",";
}
}
}
if ($in{'no'} eq 33){ ##混合部門有
##全部追加
$hname1 = 'list5';
$hname2 = 'ary5';
$out{'list5'} =$out{'list1'}.$out{'list2'};
$out{'ary5'} = $out{'ary1'}.$out{'ary2'};
## $out{'ary'} .= "\"$file_name\",";
}
}
chop $out{'ary'};
if ($in{'no'} eq 3){ ##過去
$out{'list'} =<<"EOT";
$out{'list'}
EOT
$out{'ary'} = "''," . $out{'ary'};
}
elsif ($in{'no'} eq 4 || $in{'no'} eq 5 || $in{'no'} eq 7){ ##過去
if ($in{'no'} eq 5){
$dbh_jj = &connectDB('jj');
@attribute_str = ('―','Justice','Joker');
@class_str2 = ('','特殊スーツ','改造人間','改造人間','改造人間','超能力者','エキスパート',,'ペルソナ',,'不明','人造人間(ヒト型)','人造人間(メカ型)');
$sql2 = "select pcid,name2 || '/' || name1,class,birth,sex,attribute,file_name,url,comment,type from contest_entry where no = 1 order by reg_date;";
$ref2 = $dbh_jj->selectall_arrayref($sql2) or &err("エラーが発生しました。");
foreach(@$ref2) {
($epcid,$ename,$class,undef,$sex,$attribute,$file_name,$url,$comment,$type)=@{$_};
$th_url = "../../stars/data/jj_thumbnail/$file_name";
$ma_url = "../../stars/data/jj/$file_name";
$hname1 = 'list' . $type;
$hname2 = 'ary' . $type;
$out{$hname1} .=<<"EOT";
$ename($epcid)
EOT
$out{$hname2} .= "\"$file_name\",";
}
}
$out{'list1'} =<<"EOT";
$out{'list1'}
EOT
$out{'ary1'} = "''," . $out{'ary1'};
$out{'list2'} =<<"EOT";
$out{'list2'}
EOT
$out{'ary2'} = "''," . $out{'ary2'};
$out{'list3'} =<<"EOT";
$out{'list3'}
EOT
$out{'ary3'} = "''," . $out{'ary3'};
chop $out{'ary1'};
chop $out{'ary2'};
chop $out{'ary3'};
}
else{ ##セレクトボックス作成
if ($out{'list1'} ne ''){
$out{'list1'} =<<"EOT";
$out{'list1'}
EOT
if($num_type < 10){
$out{'ary1'} = "'gx_0.png'," . $out{'ary1'};
chop $out{'ary1'};
}else{
$out{'ary1'} = "'http://rexi.jp/gx/event/con_thumbnail/gx_0.png'," . $out{'ary1'};
chop $out{'ary1'};
$out{'ary1_2'} = "''," . $out{'ary1_2'};
chop $out{'ary1_2'};
$out{'ary1_3'} = "''," . $out{'ary1_3'};
chop $out{'ary1_3'};
$out{'ary1_4'} = "''," . $out{'ary1_4'};
chop $out{'ary1_4'};
$out{'ary1_5'} = "''," . $out{'ary1_5'};
chop $out{'ary1_5'};
}
}
if ($out{'list2'} ne ''){
$out{'list2'} =<<"EOT";
$out{'list2'}
EOT
$out{'ary2'} = "'gx_0.png'," . $out{'ary2'};
chop $out{'ary2'};
}
if($out{'no'} eq 33){
if ($out{'list5'} ne ''){
$out{'list5'} =<<"EOT";
$out{'list5'}
EOT
$out{'ary5'} = "'gx_0.png'," . $out{'ary5'};
chop $out{'ary5'};
}
}
if ($out{'list3'} ne ''){
$out{'list3'} =<<"EOT";
$out{'list3'}
EOT
$out{'ary3'} = "'gx_0.png'," . $out{'ary3'};
chop $out{'ary3'};
}
if ($out{'list4'} ne ''){
$out{'list4'} =<<"EOT";
$out{'list4'}
EOT
$out{'ary4'} = "'gx_0.png'," . $out{'ary4'};
chop $out{'ary4'};
}
if($out{'no'} ne 33){
if ($out{'list5'} ne ''){
$out{'list5'} =<<"EOT";
$out{'list5'}
EOT
$out{'ary5'} = "''," . $out{'ary5'};
chop $out{'ary5'};
}
}
if ($out{'list6'} ne ''){
$out{'list6'} =<<"EOT";
$out{'list6'}
EOT
$out{'ary6'} = "''," . $out{'ary6'};
chop $out{'ary6'};
}
}
if($pol_sheet eq 0){ ##汎用/専用
##汎用
if(@num_title[1] ne ''){
if($in{'no'} eq 27){ ##学生会選挙
$out{list} =<<"EOT";
●@num_title[1]
$out{'list1'}
EOT
}elsif($in{'no'} eq 29){ ##夏娘夏男
$out{list} =<<"EOT";
●夏娘部門
$out{'list1'}
$out{'list1'}
$out{'list1'}
EOT
$out{list} .=<<"EOT";
●夏男部門
$out{'list2'}
$out{'list2'}
$out{'list2'}
EOT
}else{
$out{list} =<<"EOT";
●@num_title[1]
$out{'list1'}
$out{'list1'}
$out{'list1'}
EOT
}
}
if(@num_title[2] ne ''){
if($in{'no'} eq 29){ ##夏娘夏男
$out{list} .=<<"EOT";
●裏・夏娘部門
$out{'list1'}
$out{'list1'}
$out{'list1'}
EOT
$out{list} .=<<"EOT";
●裏・夏男部門
$out{'list2'}
$out{'list2'}
$out{'list2'}
EOT
}else{
$out{list} .=<<"EOT";
●@num_title[2]
$out{'list2'}
$out{'list2'}
$out{'list2'}
EOT
}
}
if($out{'no'} eq 33){
$out{list} .=<<"EOT";
●@num_title[5]
$out{'list5'}
$out{'list5'}
$out{'list5'}
EOT
}
if(@num_title[3] ne ''){
$out{list} .=<<"EOT";
●@num_title[3]
$out{'list3'}
$out{'list3'}
$out{'list3'}
EOT
}
if(@num_title[4] ne ''){
$out{list} .=<<"EOT";
●@num_title[4]
$out{'list4'}
$out{'list4'}
$out{'list4'}
EOT
}
}else{
if($in{'no'} eq 27){ ##学生会選挙
$out{list} =<<"EOT";
●@num_title[1]
$out{'list1'}
EOT
}
}
&out_enc;
&html_out($html_file);
}
#---------------------------------------
# 投票確認
#---------------------------------------
sub poll_conf {
if ($in{'no'} eq 0){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200908172400"){&err("投票期間を過ぎています。");}
$html_file = "event_poll02.html";
if ($in{'poll_pcid'} eq 'xa0124'){
$out{'poll_name'} = 'ガブリエル・スターロード';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0124_G02_0424_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0164'){
$out{'poll_name'} = 'ベアトリクス・ユニバス';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0164_G02_0406_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0313'){
$out{'poll_name'} = 'ヴァルチャー・マンチェスター';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0313_G01_0352_01.png';
}
elsif ($in{'poll_pcid'} eq 'xz0008'){
$out{'poll_name'} = 'クリス・フォン・セギュール';
$out{'poll_zen'} = '../images/npc/chris.png';
}
elsif ($in{'poll_pcid'} eq 'xa0313'){
$out{'poll_name'} = 'グラナート・ミストファイア';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0501_G01_0122_01.png';
}
}
elsif ($in{'no'} eq 1){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200908261500"){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_xh01.html";
if ($in{'poll_1'} eq '' || $in{'poll_2'} eq ''){&err("投票先が選択されていません。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll_1'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-44 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll_2'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-45 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
}
elsif ($in{'no'} eq 2){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200910062000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_xh02.html";
#&err($html_file);
if ($in{'poll1'} eq '' && $in{'poll2'} eq '' && $in{'poll3'}){&err("投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'pname1'} eq '' || $in{'pname2'} eq '' || $in{'pname3'} eq ''){&err("どのような女神か入力されていません。");}
if (length($in{'pname1'}) > 20 || length($in{'pname2'}) > 20 || length($in{'pname3'}) > 20){&err("入力テキストは全角10文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll1'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-46 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll2'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-02 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll3'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name3'},$out{'con_url3'})=@{$ref->[0]};
}
elsif ($in{'no'} eq 3){ ##過去
$html_file = "event_poll02_xh03.html";
if ($in{'daimei'} eq ''){&err("題名が入力されていません。");}
if (length($in{'daimei'}) > 30){&err("題名は全角15文字までです。");}
if ($in{'poll1'} ne '' && ($in{'poll1'} eq $in{'poll2'} || $in{'poll1'} eq $in{'poll3'} || $in{'poll1'} eq $in{'poll4'} || $in{'poll1'} eq $in{'poll5'} || $in{'poll1'} eq $in{'poll6'} || $in{'poll1'} eq $in{'poll7'} || $in{'poll1'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll2'} ne '' && ($in{'poll2'} eq $in{'poll1'} || $in{'poll2'} eq $in{'poll3'} || $in{'poll2'} eq $in{'poll4'} || $in{'poll2'} eq $in{'poll5'} || $in{'poll2'} eq $in{'poll6'} || $in{'poll2'} eq $in{'poll7'} || $in{'poll2'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll3'} ne '' && ($in{'poll3'} eq $in{'poll1'} || $in{'poll3'} eq $in{'poll2'} || $in{'poll3'} eq $in{'poll4'} || $in{'poll3'} eq $in{'poll5'} || $in{'poll3'} eq $in{'poll6'} || $in{'poll3'} eq $in{'poll7'} || $in{'poll3'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll4'} ne '' && ($in{'poll4'} eq $in{'poll1'} || $in{'poll4'} eq $in{'poll2'} || $in{'poll4'} eq $in{'poll3'} || $in{'poll4'} eq $in{'poll5'} || $in{'poll4'} eq $in{'poll6'} || $in{'poll4'} eq $in{'poll7'} || $in{'poll4'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll5'} ne '' && ($in{'poll5'} eq $in{'poll1'} || $in{'poll5'} eq $in{'poll2'} || $in{'poll5'} eq $in{'poll3'} || $in{'poll5'} eq $in{'poll4'} || $in{'poll5'} eq $in{'poll6'} || $in{'poll5'} eq $in{'poll7'} || $in{'poll5'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll6'} ne '' && ($in{'poll6'} eq $in{'poll1'} || $in{'poll6'} eq $in{'poll2'} || $in{'poll6'} eq $in{'poll3'} || $in{'poll6'} eq $in{'poll4'} || $in{'poll6'} eq $in{'poll5'} || $in{'poll6'} eq $in{'poll7'} || $in{'poll6'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll7'} ne '' && ($in{'poll7'} eq $in{'poll1'} || $in{'poll7'} eq $in{'poll2'} || $in{'poll7'} eq $in{'poll3'} || $in{'poll7'} eq $in{'poll4'} || $in{'poll7'} eq $in{'poll5'} || $in{'poll7'} eq $in{'poll6'} || $in{'poll7'} eq $in{'poll8'})){&err("重複して選択できません。");}
if ($in{'poll8'} ne '' && ($in{'poll8'} eq $in{'poll1'} || $in{'poll8'} eq $in{'poll2'} || $in{'poll8'} eq $in{'poll3'} || $in{'poll8'} eq $in{'poll4'} || $in{'poll8'} eq $in{'poll5'} || $in{'poll8'} eq $in{'poll6'} || $in{'poll8'} eq $in{'poll7'})){&err("重複して選択できません。");}
if ($in{'poll1'} ne ''){
if ($in{'pname1'} eq ''){&err("1人目の役名が入力されていません。");}
if (length($in{'pname1'}) > 24){&err("1人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll1'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-47 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
$out{'con_url1'} =<<"EOT";
EOT
}
if ($in{'poll2'} ne ''){
if ($in{'pname2'} eq ''){&err("2人目の役名が入力されていません。");}
if (length($in{'pname2'}) > 24){&err("2人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll2'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-48 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
$out{'con_url2'} =<<"EOT";
EOT
}
if ($in{'poll3'} ne ''){
if ($in{'pname3'} eq ''){&err("3人目の役名が入力されていません。");}
if (length($in{'pname3'}) > 24){&err("3人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll3'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-49 エラーが発生しました。");
($out{'con_name3'},$out{'con_url3'})=@{$ref->[0]};
$out{'con_url3'} =<<"EOT";
EOT
}
if ($in{'poll4'} ne ''){
if ($in{'pname4'} eq ''){&err("4人目の役名が入力されていません。");}
if (length($in{'pname4'}) > 24){&err("4人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll4'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-50 エラーが発生しました。");
($out{'con_name4'},$out{'con_url4'})=@{$ref->[0]};
$out{'con_url4'} =<<"EOT";
EOT
}
if ($in{'poll5'} ne ''){
if ($in{'pname5'} eq ''){&err("5人目の役名が入力されていません。");}
if (length($in{'pname5'}) > 24){&err("5人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll5'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-51 エラーが発生しました。");
($out{'con_name5'},$out{'con_url5'})=@{$ref->[0]};
$out{'con_url5'} =<<"EOT";
EOT
}
if ($in{'poll6'} ne ''){
if ($in{'pname6'} eq ''){&err("6人目の役名が入力されていません。");}
if (length($in{'pname6'}) > 24){&err("6人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll6'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-53 エラーが発生しました。");
($out{'con_name6'},$out{'con_url6'})=@{$ref->[0]};
$out{'con_url6'} =<<"EOT";
EOT
}
if ($in{'poll7'} ne ''){
if ($in{'pname7'} eq ''){&err("7人目の役名が入力されていません。");}
if (length($in{'pname7'}) > 24){&err("7人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll7'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-54 エラーが発生しました。");
($out{'con_name7'},$out{'con_url7'})=@{$ref->[0]};
$out{'con_url7'} =<<"EOT";
EOT
}
if ($in{'poll8'} ne ''){
if ($in{'pname8'} eq ''){&err("8人目の役名が入力されていません。");}
if (length($in{'pname8'}) > 24){&err("8人目の役名は全角12文字までです。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll8'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-55 エラーが発生しました。");
($out{'con_name8'},$out{'con_url8'})=@{$ref->[0]};
$out{'con_url8'} =<<"EOT";
EOT
}
$tmp = &newline_remove($in{'arasuji'});
if (length($tmp) > 600){&err("筋書きが全角300文字までです。");}
$out{'str'} = &newline_change($in{'arasuji'});
}
elsif ($in{'no'} eq 4){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200911300000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_xh04.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("ミスターローレックの投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("ミスローレックの投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("ミスターローレックの投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("ミスローレックの投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("重複して選択できません。");}
if ($in{'poll13'} eq '' || $in{'poll14'} eq '' || $in{'poll15'} eq ''){&err("樽コンの投票先が選択されていません。");}
if ((($in{'poll13'} eq $in{'poll14'}) || ($in{'poll13'} eq $in{'poll15'})) || ($in{'poll14'} eq $in{'poll15'})){&err("重複して選択できません。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll1'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-56 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll2'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-57 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll3'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-60 エラーが発生しました。");
($out{'con_name3'},$out{'con_url3'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll4'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-58 エラーが発生しました。");
($out{'con_name4'},$out{'con_url4'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll5'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-59 エラーが発生しました。");
($out{'con_name5'},$out{'con_url5'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll6'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name6'},$out{'con_url6'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll7'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-61 エラーが発生しました。");
($out{'con_name7'},$out{'con_url7'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll8'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-62 エラーが発生しました。");
($out{'con_name8'},$out{'con_url8'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll9'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-63 エラーが発生しました。");
($out{'con_name9'},$out{'con_url9'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll10'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-64 エラーが発生しました。");
($out{'con_name10'},$out{'con_url10'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll11'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name11'},$out{'con_url11'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll12'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name12'},$out{'con_url12'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll13'}' and type = 3;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name13'},$out{'con_url13'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll14'}' and type = 3;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name14'},$out{'con_url14'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll15'}' and type = 3;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name15'},$out{'con_url15'})=@{$ref->[0]};
}
elsif ($in{'no'} eq 5){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201001060000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_xh05.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("紳士部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("淑女部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("ピエロ部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
$dbh_jj = &connectDB('jj');
if (substr($in{'poll1'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll1'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-65 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll1'}' and type = 1;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-66 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
}
if (substr($in{'poll2'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll2'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-67 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll2'}' and type = 1;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-68 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
}
if (substr($in{'poll3'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll3'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name3'},$out{'con_url3'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll3'}' and type = 1;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-69 エラーが発生しました。");
($out{'con_name3'},$out{'con_url3'})=@{$ref->[0]};
}
if (substr($in{'poll4'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll4'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-70 エラーが発生しました。");
($out{'con_name4'},$out{'con_url4'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll4'}' and type = 2;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-71 エラーが発生しました。");
($out{'con_name4'},$out{'con_url4'})=@{$ref->[0]};
}
if (substr($in{'poll5'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll5'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-72 エラーが発生しました。");
($out{'con_name5'},$out{'con_url5'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll5'}' and type = 2;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-73 エラーが発生しました。");
($out{'con_name5'},$out{'con_url5'})=@{$ref->[0]};
}
if (substr($in{'poll6'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll6'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name6'},$out{'con_url6'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll6'}' and type = 2;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-74 エラーが発生しました。");
($out{'con_name6'},$out{'con_url6'})=@{$ref->[0]};
}
if (substr($in{'poll7'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll7'}' and type = 3;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-75 エラーが発生しました。");
($out{'con_name7'},$out{'con_url7'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll7'}' and type = 3;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-76 エラーが発生しました。");
($out{'con_name7'},$out{'con_url7'})=@{$ref->[0]};
}
if (substr($in{'poll8'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll8'}' and type = 3;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-77 エラーが発生しました。");
($out{'con_name8'},$out{'con_url8'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll8'}' and type = 3;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-78 エラーが発生しました。");
($out{'con_name8'},$out{'con_url8'})=@{$ref->[0]};
}
if (substr($in{'poll9'},0,1) eq 'x'){
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll9'}' and type = 3;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-79 エラーが発生しました。");
($out{'con_name9'},$out{'con_url9'})=@{$ref->[0]};
}
else{
$sql = "select name2 || '/' || name1,url from contest_entry where no = 1 and pcid = '$in{'poll9'}' and type = 3;";
$ref = $dbh_jj->selectall_arrayref($sql) or &err("CODE:S-80 エラーが発生しました。");
($out{'con_name9'},$out{'con_url9'})=@{$ref->[0]};
}
}
elsif ($in{'no'} eq 6){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201002230000"){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_xh06.html";
if ($in{'poll1'} ne '' && ($in{'poll1'} eq $in{'poll2'} || $in{'poll1'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll2'} ne '' && ($in{'poll2'} eq $in{'poll1'} || $in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll3'} ne '' && ($in{'poll3'} eq $in{'poll1'} || $in{'poll3'} eq $in{'poll2'})){&err("重複して選択できません。");}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll1'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-81 エラーが発生しました。");
($out{'con_name1'},$out{'con_url1'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll2'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-82 エラーが発生しました。");
($out{'con_name2'},$out{'con_url2'})=@{$ref->[0]};
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{'poll3'}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-03 エラーが発生しました。");
($out{'con_name3'},$out{'con_url3'})=@{$ref->[0]};
}
elsif ($in{'no'} eq 7){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con07.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("ベストカップル部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("ベストパートナー部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("ベストファンタジー部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
$out{'con_url1'} = $in{'poll1'};
$con_file1 = substr($in{'poll1'},10);
$entry_epcid_1 = substr($in{'poll1'},10,6);
$entry_tar_pcid_1 = substr($in{'poll1'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-83 エラーが発生しました。");
($con_ename1)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-84 エラーが発生しました。");
($con_tname1)=@{$ref->[0]};
$out{'con_name1'} = $con_ename1 . '&' . $con_tname1;
$out{'con_url2'} = $in{'poll2'};
$con_file2 = substr($in{'poll2'},10);
$entry_epcid_2 = substr($in{'poll2'},10,6);
$entry_tar_pcid_2 = substr($in{'poll2'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-85 エラーが発生しました。");
($con_ename2)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-86 エラーが発生しました。");
($con_tname2)=@{$ref->[0]};
$out{'con_name2'} = $con_ename2 . '&' . $con_tname2;
$out{'con_url3'} = $in{'poll3'};
$con_file3 = substr($in{'poll3'},10);
$entry_epcid_3 = substr($in{'poll3'},10,6);
$entry_tar_pcid_3 = substr($in{'poll3'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-87 エラーが発生しました。");
($con_ename3)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-88 エラーが発生しました。");
($con_tname3)=@{$ref->[0]};
$out{'con_name3'} = $con_ename3 . '&' . $con_tname3;
$out{'con_url4'} = $in{'poll4'};
$con_file4 = substr($in{'poll4'},10);
$entry_epcid_4 = substr($in{'poll4'},10,6);
$entry_tar_pcid_4 = substr($in{'poll4'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-89 エラーが発生しました。");
($con_ename4)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-90 エラーが発生しました。");
($con_tname4)=@{$ref->[0]};
$out{'con_name4'} = $con_ename4 . '&' . $con_tname4;
$out{'con_url5'} = $in{'poll5'};
$con_file5 = substr($in{'poll5'},10);
$entry_epcid_5 = substr($in{'poll5'},10,6);
$entry_tar_pcid_5 = substr($in{'poll5'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-91 エラーが発生しました。");
($con_ename5)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-92 エラーが発生しました。");
($con_tname5)=@{$ref->[0]};
$out{'con_name5'} = $con_ename5 . '&' . $con_tname5;
$out{'con_url6'} = $in{'poll6'};
$con_file6 = substr($in{'poll6'},10);
$entry_epcid_6 = substr($in{'poll6'},10,6);
$entry_tar_pcid_6 = substr($in{'poll6'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-93 エラーが発生しました。");
($con_ename6)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-94 エラーが発生しました。");
($con_tname6)=@{$ref->[0]};
$out{'con_name6'} = $con_ename6 . '&' . $con_tname6;
$out{'con_url7'} = $in{'poll7'};
$con_file7 = substr($in{'poll7'},10);
$entry_epcid_7 = substr($in{'poll7'},10,6);
$entry_tar_pcid_7 = substr($in{'poll7'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-95 エラーが発生しました。");
($con_ename7)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-96 エラーが発生しました。");
($con_tname7)=@{$ref->[0]};
$out{'con_name7'} = $con_ename7 . '&' . $con_tname7;
$out{'con_url8'} = $in{'poll8'};
$con_file8 = substr($in{'poll8'},10);
$entry_epcid_8 = substr($in{'poll8'},10,6);
$entry_tar_pcid_8 = substr($in{'poll8'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-97 エラーが発生しました。");
($con_ename8)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-98 エラーが発生しました。");
($con_tname8)=@{$ref->[0]};
$out{'con_name8'} = $con_ename8 . '&' . $con_tname8;
$out{'con_url9'} = $in{'poll9'};
$con_file9 = substr($in{'poll9'},10);
$entry_epcid_9 = substr($in{'poll9'},10,6);
$entry_tar_pcid_9 = substr($in{'poll9'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-99 エラーが発生しました。");
($con_ename9)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-100 エラーが発生しました。");
($con_tname9)=@{$ref->[0]};
$out{'con_name9'} = $con_ename9 . '&' . $con_tname9;
}
elsif ($in{'no'} eq 8){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con08.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("男子通常制服部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("女子通常制服部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("男子改造制服部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("女子改造制服部門の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{$hname}'";
if ($in{'no'} eq 8){
if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
if ($i >= 4 && $i <= 6){$sql .= " and type = 2";}
if ($i >= 7 && $i <= 9){$sql .= " and type = 3";}
if ($i >= 10 && $i <= 12){$sql .= " and type = 4";}
}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-101 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 9){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_chairperson2.html";
if ($in{'poll_pcid'} eq 'xa0124'){
$out{'poll_name'} = 'ガブリエル・スターロード';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0124_G02_0424_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0164'){
$out{'poll_name'} = 'ベアトリクス・ユニバス';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0164_C14_0406_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0313'){
$out{'poll_name'} = 'ヴァルチャー・マンチェスター';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0313_G01_0352_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0313'){
$out{'poll_name'} = 'グラナート・ミストファイア';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0501_G01_0122_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa1952'){
$out{'poll_name'} = 'ジュジュ・ウォートホッグ';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa1952_G01_0269_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa3382'){
$out{'poll_name'} = 'ラド・デヴァイス';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa3382_G01_0040_02.png';
}
elsif ($in{'poll_pcid'} eq 'xa3827'){
$out{'poll_name'} = 'フィヨロ・ウラージェ';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa3827_G01_0624_01.png';
}
elsif ($in{'poll_pcid'} eq 'xb0251'){
$out{'poll_name'} = 'マヤ・スカイイースト';
$out{'poll_zen'} = '../../stars/data/gx/gx_xb0251_C13_0644_01.png';
}
elsif ($in{'poll_pcid'} eq 'xz0008'){
$out{'poll_name'} = 'クリス・フォン・セギュール';
$out{'poll_zen'} = '../images/npc/chris.png';
}
}
elsif ($in{'no'} eq 10){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con10.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("公式運動着部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("公式スクール水着部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("裏運動着部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("裏スクール水着部門の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("重複して選択できません。");}
$out{'con_url1'} = $in{'poll1'};
$con_file1 = substr($in{'poll1'},10);
$entry_epcid_1 = substr($in{'poll1'},10,6);
$entry_tar_pcid_1 = substr($in{'poll1'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-102 エラーが発生しました。");
($con_ename1)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-103 エラーが発生しました。");
($con_tname1)=@{$ref->[0]};
$out{'con_name1'} = $con_ename1 . '&' . $con_tname1;
$out{'con_url2'} = $in{'poll2'};
$con_file2 = substr($in{'poll2'},10);
$entry_epcid_2 = substr($in{'poll2'},10,6);
$entry_tar_pcid_2 = substr($in{'poll2'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-104 エラーが発生しました。");
($con_ename2)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-105 エラーが発生しました。");
($con_tname2)=@{$ref->[0]};
$out{'con_name2'} = $con_ename2 . '&' . $con_tname2;
$out{'con_url3'} = $in{'poll3'};
$con_file3 = substr($in{'poll3'},10);
$entry_epcid_3 = substr($in{'poll3'},10,6);
$entry_tar_pcid_3 = substr($in{'poll3'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-106 エラーが発生しました。");
($con_ename3)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-107 エラーが発生しました。");
($con_tname3)=@{$ref->[0]};
$out{'con_name3'} = $con_ename3 . '&' . $con_tname3;
$out{'con_url4'} = $in{'poll4'};
$con_file4 = substr($in{'poll4'},10);
$entry_epcid_4 = substr($in{'poll4'},10,6);
$entry_tar_pcid_4 = substr($in{'poll4'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-108 エラーが発生しました。");
($con_ename4)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-109 エラーが発生しました。");
($con_tname4)=@{$ref->[0]};
$out{'con_name4'} = $con_ename4 . '&' . $con_tname4;
$out{'con_url5'} = $in{'poll5'};
$con_file5 = substr($in{'poll5'},10);
$entry_epcid_5 = substr($in{'poll5'},10,6);
$entry_tar_pcid_5 = substr($in{'poll5'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-110 エラーが発生しました。");
($con_ename5)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-111 エラーが発生しました。");
($con_tname5)=@{$ref->[0]};
$out{'con_name5'} = $con_ename5 . '&' . $con_tname5;
$out{'con_url6'} = $in{'poll6'};
$con_file6 = substr($in{'poll6'},10);
$entry_epcid_6 = substr($in{'poll6'},10,6);
$entry_tar_pcid_6 = substr($in{'poll6'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-112 エラーが発生しました。");
($con_ename6)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-113 エラーが発生しました。");
($con_tname6)=@{$ref->[0]};
$out{'con_name6'} = $con_ename6 . '&' . $con_tname6;
$out{'con_url7'} = $in{'poll7'};
$con_file7 = substr($in{'poll7'},10);
$entry_epcid_7 = substr($in{'poll7'},10,6);
$entry_tar_pcid_7 = substr($in{'poll7'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-114 エラーが発生しました。");
($con_ename7)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-115 エラーが発生しました。");
($con_tname7)=@{$ref->[0]};
$out{'con_name7'} = $con_ename7 . '&' . $con_tname7;
$out{'con_url8'} = $in{'poll8'};
$con_file8 = substr($in{'poll8'},10);
$entry_epcid_8 = substr($in{'poll8'},10,6);
$entry_tar_pcid_8 = substr($in{'poll8'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-116 エラーが発生しました。");
($con_ename8)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-117 エラーが発生しました。");
($con_tname8)=@{$ref->[0]};
$out{'con_name8'} = $con_ename8 . '&' . $con_tname8;
$out{'con_url9'} = $in{'poll9'};
$con_file9 = substr($in{'poll9'},10);
$entry_epcid_9 = substr($in{'poll9'},10,6);
$entry_tar_pcid_9 = substr($in{'poll9'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-118 エラーが発生しました。");
($con_ename9)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-119 エラーが発生しました。");
($con_tname9)=@{$ref->[0]};
$out{'con_name9'} = $con_ename9 . '&' . $con_tname9;
$out{'con_url10'} = $in{'poll10'};
$con_file10 = substr($in{'poll10'},10);
$entry_epcid_10 = substr($in{'poll10'},10,6);
$entry_tar_pcid_10 = substr($in{'poll10'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_10';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-120 エラーが発生しました。");
($con_ename10)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_10';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-121 エラーが発生しました。");
($con_tname10)=@{$ref->[0]};
$out{'con_name10'} = $con_ename10 . '&' . $con_tname10;
$out{'con_url11'} = $in{'poll11'};
$con_file11 = substr($in{'poll11'},10);
$entry_epcid_11 = substr($in{'poll11'},10,6);
$entry_tar_pcid_11 = substr($in{'poll11'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_11';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-122 エラーが発生しました。");
($con_ename11)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_11';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-123 エラーが発生しました。");
($con_tname11)=@{$ref->[0]};
$out{'con_name11'} = $con_ename11 . '&' . $con_tname11;
$out{'con_url12'} = $in{'poll12'};
$con_file12 = substr($in{'poll12'},10);
$entry_epcid_12 = substr($in{'poll12'},10,6);
$entry_tar_pcid_12 = substr($in{'poll12'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_12';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-124 エラーが発生しました。");
($con_ename12)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_12';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-125 エラーが発生しました。");
($con_tname12)=@{$ref->[0]};
$out{'con_name12'} = $con_ename12 . '&' . $con_tname12;
}
elsif ($in{'no'} eq 11){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con11.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("夏娘部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("夏男部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("浴衣娘部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("浴衣男部門の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{$hname}'";
if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
if ($i >= 4 && $i <= 6){$sql .= " and type = 2";}
if ($i >= 7 && $i <= 9){$sql .= " and type = 3";}
if ($i >= 10 && $i <= 12){$sql .= " and type = 4";}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-126 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 12){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con12.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("ビフォー部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("アフター部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{$hname}'";
if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
if ($i >= 4 && $i <= 6){$sql .= " and type = 2";}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-127 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 13){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con13.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq ''){&err("ミスター部門の投票先が選択されていません。");}
if ($in{'poll1'} eq $in{'poll2'}){&err("ミスター部門が重複して選択できません。");}
if ($in{'poll3'} eq '' || $in{'poll4'} eq ''){&err("ミス部門の投票先が選択されていません。");}
if ($in{'poll3'} eq $in{'poll4'}){&err("ミス部門が重複して選択できません。");}
if ($in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("男子学生証部門の投票先が選択されていません。");}
if ($in{'poll5'} eq $in{'poll6'}){&err("男子学生証部門が重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq ''){&err("女子学生証部門の投票先が選択されていません。");}
if ($in{'poll7'} eq $in{'poll8'}){&err("女子学生証部門が重複して選択できません。");}
if ($in{'poll9'} eq '' || $in{'poll10'} eq ''){&err("スマイルアイコン部門の投票先が選択されていません。");}
if ($in{'poll9'} eq $in{'poll10'}){&err("スマイルアイコン部門が重複して選択できません。");}
if ($in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("裏部門の投票先が選択されていません。");}
if ($in{'poll11'} eq $in{'poll12'}){&err("裏部門が重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and pcid = '$in{$hname}'";
if ($i >= 1 && $i <= 2){$sql .= " and type = 1";}
elsif ($i >= 3 && $i <= 4){$sql .= " and type = 2";}
elsif ($i >= 5 && $i <= 6){$sql .= " and type = 3";}
elsif ($i >= 7 && $i <= 8){$sql .= " and type = 4";}
elsif ($i >= 9 && $i <= 10){$sql .= " and type = 5";}
elsif ($i >= 11 && $i <= 12){$sql .= " and type in (1,2)";}
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-128 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
$sql = "select name from contest_entry where no = $in{'no'} and file_name = '$in{'poll11'}' and type = 1;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-129 エラーが発生しました。");
($out{'con_name11'})=@{$ref->[0]};
$sql = "select name from contest_entry where no = $in{'no'} and file_name = '$in{'poll12'}' and type = 2;";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-130 エラーが発生しました。");
($out{'con_name12'})=@{$ref->[0]};
$out{'con_url11'} = 'http://rexi.jp/stars/data/gx/' . $in{'poll11'};
$out{'con_url12'} = 'http://rexi.jp/stars/data/gx/' . $in{'poll12'};
}
elsif ($in{'no'} eq 14){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("クールサンタ部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("クールサンタ部門は重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("キュートサンタ部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("キュートサンタ部門は重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("パーティ部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("パーティ部門は重複して選択できません。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("ピエロ部門の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("ピエロ部門は重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-131 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
$html_file = "event_poll02_con14.html";
}
elsif ($in{'no'} eq 15){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con15.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("ベストカップル部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("ベストパートナー部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("ベストファンタジー部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
$out{'con_url1'} = $in{'poll1'};
$con_file1 = substr($in{'poll1'},10);
$entry_epcid_1 = substr($in{'poll1'},10,6);
$entry_tar_pcid_1 = substr($in{'poll1'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-132 エラーが発生しました。");
($con_ename1)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-133 エラーが発生しました。");
($con_tname1)=@{$ref->[0]};
$out{'con_name1'} = $con_ename1 . '&' . $con_tname1;
$out{'con_url2'} = $in{'poll2'};
$con_file2 = substr($in{'poll2'},10);
$entry_epcid_2 = substr($in{'poll2'},10,6);
$entry_tar_pcid_2 = substr($in{'poll2'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-134 エラーが発生しました。");
($con_ename2)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-135 エラーが発生しました。");
($con_tname2)=@{$ref->[0]};
$out{'con_name2'} = $con_ename2 . '&' . $con_tname2;
$out{'con_url3'} = $in{'poll3'};
$con_file3 = substr($in{'poll3'},10);
$entry_epcid_3 = substr($in{'poll3'},10,6);
$entry_tar_pcid_3 = substr($in{'poll3'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-136 エラーが発生しました。");
($con_ename3)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-137 エラーが発生しました。");
($con_tname3)=@{$ref->[0]};
$out{'con_name3'} = $con_ename3 . '&' . $con_tname3;
$out{'con_url4'} = $in{'poll4'};
$con_file4 = substr($in{'poll4'},10);
$entry_epcid_4 = substr($in{'poll4'},10,6);
$entry_tar_pcid_4 = substr($in{'poll4'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-138 エラーが発生しました。");
($con_ename4)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-139 エラーが発生しました。");
($con_tname4)=@{$ref->[0]};
$out{'con_name4'} = $con_ename4 . '&' . $con_tname4;
$out{'con_url5'} = $in{'poll5'};
$con_file5 = substr($in{'poll5'},10);
$entry_epcid_5 = substr($in{'poll5'},10,6);
$entry_tar_pcid_5 = substr($in{'poll5'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-140 エラーが発生しました。");
($con_ename5)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-141 エラーが発生しました。");
($con_tname5)=@{$ref->[0]};
$out{'con_name5'} = $con_ename5 . '&' . $con_tname5;
$out{'con_url6'} = $in{'poll6'};
$con_file6 = substr($in{'poll6'},10);
$entry_epcid_6 = substr($in{'poll6'},10,6);
$entry_tar_pcid_6 = substr($in{'poll6'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-142 エラーが発生しました。");
($con_ename6)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-143 エラーが発生しました。");
($con_tname6)=@{$ref->[0]};
$out{'con_name6'} = $con_ename6 . '&' . $con_tname6;
$out{'con_url7'} = $in{'poll7'};
$con_file7 = substr($in{'poll7'},10);
$entry_epcid_7 = substr($in{'poll7'},10,6);
$entry_tar_pcid_7 = substr($in{'poll7'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-144 エラーが発生しました。");
($con_ename7)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-145 エラーが発生しました。");
($con_tname7)=@{$ref->[0]};
$out{'con_name7'} = $con_ename7 . '&' . $con_tname7;
$out{'con_url8'} = $in{'poll8'};
$con_file8 = substr($in{'poll8'},10);
$entry_epcid_8 = substr($in{'poll8'},10,6);
$entry_tar_pcid_8 = substr($in{'poll8'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-146 エラーが発生しました。");
($con_ename8)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-147 エラーが発生しました。");
($con_tname8)=@{$ref->[0]};
$out{'con_name8'} = $con_ename8 . '&' . $con_tname8;
$out{'con_url9'} = $in{'poll9'};
$con_file9 = substr($in{'poll9'},10);
$entry_epcid_9 = substr($in{'poll9'},10,6);
$entry_tar_pcid_9 = substr($in{'poll9'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-148 エラーが発生しました。");
($con_ename9)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-149 エラーが発生しました。");
($con_tname9)=@{$ref->[0]};
$out{'con_name9'} = $con_ename9 . '&' . $con_tname9;
}
elsif ($in{'no'} eq 17){ ##過去
if ($in{'poll_pcid'} eq ''){&err("投票候補が選択されていません。");}
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_chairperson3.html";
if ($in{'poll_pcid'} eq 'xa0164'){
$out{'poll_name'} = 'ベアトリクス・ユニバス';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0164_G02_0406_02.png';
}
elsif ($in{'poll_pcid'} eq 'xa0294'){
$out{'poll_name'} = 'キリト・アレグレヴ';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0294_C13_0754_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0313'){
$out{'poll_name'} = 'ヴァルチャー・マンチェスター';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0313_G01_0352_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa0313'){
$out{'poll_name'} = 'グラナート・ミストファイア';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa0501_G01_0122_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa2284'){
$out{'poll_name'} = 'ゼラニウム・ルージュ';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa2284_G02_0173_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa3827'){
$out{'poll_name'} = 'フィヨロ・ウラージェ';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa3827_G01_0624_01.png';
}
elsif ($in{'poll_pcid'} eq 'xa5668'){
$out{'poll_name'} = 'ロベルタ・ベルナルディア';
$out{'poll_zen'} = '../../stars/data/gx/gx_xa5668_C13_0695_01.png';
}
elsif ($in{'poll_pcid'} eq 'xb0251'){
$out{'poll_name'} = 'マヤ・スカイイースト';
$out{'poll_zen'} = '../../stars/data/gx/gx_xb0251_C13_0644_01.png';
}
elsif ($in{'poll_pcid'} eq 'xb8513'){
$out{'poll_name'} = 'グィネヴィア・グレンリベット';
$out{'poll_zen'} = '../../stars/data/gx/gx_xb8513_G01_0527_01.png';
}
elsif ($in{'poll_pcid'} eq 'xc0280'){
$out{'poll_name'} = 'ミント・スカイイースト';
$out{'poll_zen'} = '../../stars/data/gx/gx_xc0280_C13_0378_01.png';
}
elsif ($in{'poll_pcid'} eq 'xz0008'){
$out{'poll_name'} = 'クリス・フォン・セギュール';
$out{'poll_zen'} = '../images/npc/chris.png';
}
}
elsif ($in{'no'} eq 16){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con16.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("男子通常制服部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("女子通常制服部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("男子改造制服部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("女子改造制服部門の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
if ($in{'no'} eq 8){
if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
if ($i >= 4 && $i <= 6){$sql .= " and type = 3";}
if ($i >= 7 && $i <= 9){$sql .= " and type = 2";}
if ($i >= 10 && $i <= 12){$sql .= " and type = 4";}
}
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-150 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 18){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con18.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("男子グリーヴァ衣装部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("女子グリーヴァ衣装部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("グリーブス部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
if ($in{'no'} eq 8){
if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
if ($i >= 4 && $i <= 6){$sql .= " and type = 2";}
if ($i >= 7 && $i <= 9){$sql .= " and type = 3";}
}
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-151 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 19){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con19.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("女子夏コン部門の投票候補が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("男子夏コン部門の投票候補が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
## if ($in{'no'} eq 8){
## if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
## if ($i >= 4 && $i <= 6){$sql .= " and type = 2";}
## if ($i >= 7 && $i <= 9){$sql .= " and type = 3";}
## }
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-152 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 20){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con20.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("投票候補が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
$out{'con_url1'} = $in{'poll1'};
$con_file1 = substr($in{'poll1'},10);
$entry_epcid_1 = substr($in{'poll1'},10,6);
$entry_tar_pcid_1 = substr($in{'poll1'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-153 エラーが発生しました。");
($con_ename1)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-154 エラーが発生しました。");
($con_tname1)=@{$ref->[0]};
$out{'con_name1'} = $con_ename1 . '&' . $con_tname1;
$out{'con_url2'} = $in{'poll2'};
$con_file2 = substr($in{'poll2'},10);
$entry_epcid_2 = substr($in{'poll2'},10,6);
$entry_tar_pcid_2 = substr($in{'poll2'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-156 エラーが発生しました。");
($con_ename2)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-157 エラーが発生しました。");
($con_tname2)=@{$ref->[0]};
$out{'con_name2'} = $con_ename2 . '&' . $con_tname2;
$out{'con_url3'} = $in{'poll3'};
$con_file3 = substr($in{'poll3'},10);
$entry_epcid_3 = substr($in{'poll3'},10,6);
$entry_tar_pcid_3 = substr($in{'poll3'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-158 エラーが発生しました。");
($con_ename3)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-159 エラーが発生しました。");
($con_tname3)=@{$ref->[0]};
$out{'con_name3'} = $con_ename3 . '&' . $con_tname3;
}
elsif ($in{'no'} eq 21){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
$html_file = "event_poll02_con21.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("仮装娘部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("仮装娘部門の投票先が重複しています。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("仮装男部門の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("仮装男部門の投票先が重複しています。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("オモシロ仮装部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("オモシロ仮装部門の投票先が重複しています。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("人形コンの投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("人形コンの投票先が重複しています。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
if ($in{'no'} eq 8){
if ($i >= 1 && $i <= 3){$sql .= " and type = 1";}
if ($i >= 4 && $i <= 6){$sql .= " and type = 3";}
if ($i >= 7 && $i <= 9){$sql .= " and type = 2";}
if ($i >= 10 && $i <= 12){$sql .= " and type = 4";}
}
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-160 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
elsif ($in{'no'} eq 22){ ##過去
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$html_file = "event_poll02_con$in{'no'}.html";
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("ミスター部門の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("ミスター部門の投票先が重複しています。");}
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("ミスター部門裏の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("ミスター部門裏の投票先が重複しています。");}
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("ミス部門の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("ミス部門の投票先が重複しています。");}
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("ミス部門裏の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("ミス部門裏の投票先が重複しています。");}
if ($in{'poll13'} eq '' || $in{'poll14'} eq '' || $in{'poll15'} eq ''){&err("X意匠アイコン コンテストの投票先が選択されていません。");}
if ((($in{'poll13'} eq $in{'poll14'}) || ($in{'poll13'} eq $in{'poll15'})) || ($in{'poll14'} eq $in{'poll15'})){&err("X意匠アイコン コンテストの投票先が重複しています。");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-161 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}elsif($in{'no'} eq 27) { ##学生会選挙
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-162 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
if(@num_title[1] ne ''){
if ($in{'poll1'} eq ''){&err("@num_title[1]の投票先が選択されていません。");}
$out{'list'} .=<<"EOT";
@num_title[1]
$out{'con_name1'}
EOT
}
$html_file = "event_poll02_con_n.html";
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-163 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}elsif(($in{'no'} >= 23) && ($num_type eq 2)) { ##あわせ
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$html_file = "event_poll02_con_n.html";
if(@num_title[1] ne ''){
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("投票候補が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("重複して選択できません。");}
$out{'con_url1'} = $in{'poll1'};
$con_file1 = substr($in{'poll1'},10);
$entry_epcid_1 = substr($in{'poll1'},10,6);
$entry_tar_pcid_1 = substr($in{'poll1'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-164 エラーが発生しました。");
($con_ename1)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_1';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-165 エラーが発生しました。");
($con_tname1)=@{$ref->[0]};
$out{'con_name1'} = $con_ename1 . '&' . $con_tname1;
$out{'con_url2'} = $in{'poll2'};
$con_file2 = substr($in{'poll2'},10);
$entry_epcid_2 = substr($in{'poll2'},10,6);
$entry_tar_pcid_2 = substr($in{'poll2'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-166 エラーが発生しました。");
($con_ename2)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_2';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-167 エラーが発生しました。");
($con_tname2)=@{$ref->[0]};
$out{'con_name2'} = $con_ename2 . '&' . $con_tname2;
$out{'con_url3'} = $in{'poll3'};
$con_file3 = substr($in{'poll3'},10);
$entry_epcid_3 = substr($in{'poll3'},10,6);
$entry_tar_pcid_3 = substr($in{'poll3'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-168 エラーが発生しました。");
($con_ename3)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_3';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-169 エラーが発生しました。");
($con_tname3)=@{$ref->[0]};
$out{'con_name3'} = $con_ename3 . '&' . $con_tname3;
$out{'list'} .=<<"EOT";
@num_title[1]
$out{'con_name1'}
$out{'con_name2'}
$out{'con_name3'}
EOT
}
if(@num_title[2] ne ''){
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("投票候補が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("重複して選択できません。");}
$out{'con_url4'} = $in{'poll4'};
$con_file4 = substr($in{'poll4'},10);
$entry_epcid_4 = substr($in{'poll4'},10,6);
$entry_tar_pcid_4 = substr($in{'poll4'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-170 エラーが発生しました。");
($con_ename4)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_4';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-171 エラーが発生しました。");
($con_tname4)=@{$ref->[0]};
$out{'con_name4'} = $con_ename4 . '&' . $con_tname4;
$out{'con_url5'} = $in{'poll5'};
$con_file5 = substr($in{'poll5'},10);
$entry_epcid_5 = substr($in{'poll5'},10,6);
$entry_tar_pcid_5 = substr($in{'poll5'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-172 エラーが発生しました。");
($con_ename5)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_5';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-173 エラーが発生しました。");
($con_tname5)=@{$ref->[0]};
$out{'con_name5'} = $con_ename5 . '&' . $con_tname5;
$out{'con_url6'} = $in{'poll6'};
$con_file6 = substr($in{'poll6'},10);
$entry_epcid_6 = substr($in{'poll6'},10,6);
$entry_tar_pcid_6 = substr($in{'poll6'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-174 エラーが発生しました。");
($con_ename6)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_6';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-175 エラーが発生しました。");
($con_tname6)=@{$ref->[0]};
$out{'con_name6'} = $con_ename6 . '&' . $con_tname6;
$out{'list'} .=<<"EOT";
@num_title[2]
$out{'con_name4'}
$out{'con_name5'}
$out{'con_name6'}
EOT
}
if(@num_title[3] ne ''){
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("投票候補が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("重複して選択できません。");}
$out{'con_url7'} = $in{'poll7'};
$con_file7 = substr($in{'poll7'},10);
$entry_epcid_7 = substr($in{'poll7'},10,6);
$entry_tar_pcid_7 = substr($in{'poll7'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-176 エラーが発生しました。");
($con_ename7)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_7';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-177 エラーが発生しました。");
($con_tname7)=@{$ref->[0]};
$out{'con_name7'} = $con_ename7 . '&' . $con_tname7;
$out{'con_url8'} = $in{'poll8'};
$con_file8 = substr($in{'poll8'},10);
$entry_epcid_8 = substr($in{'poll8'},10,6);
$entry_tar_pcid_8 = substr($in{'poll8'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-178 エラーが発生しました。");
($con_ename8)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_8';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-179 エラーが発生しました。");
($con_tname8)=@{$ref->[0]};
$out{'con_name8'} = $con_ename8 . '&' . $con_tname8;
$out{'con_url9'} = $in{'poll9'};
$con_file9 = substr($in{'poll9'},10);
$entry_epcid_9 = substr($in{'poll9'},10,6);
$entry_tar_pcid_9 = substr($in{'poll9'},17,6);
$sql = "select name from character where pcid = '$entry_epcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-180 エラーが発生しました。");
($con_ename9)=@{$ref->[0]};
$sql = "select name from character where pcid = '$entry_tar_pcid_9';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-181 エラーが発生しました。");
($con_tname9)=@{$ref->[0]};
$out{'con_name9'} = $con_ename9 . '&' . $con_tname9;
$out{'list'} .=<<"EOT";
@num_title[3]
$out{'con_name7'}
$out{'con_name8'}
$out{'con_name9'}
EOT
}
}elsif (($in{'no'} >= 23) and ($num_type >= 10)){ ##汎用シート ボイス
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$out{'list'} = '';
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
$curl2 = 'con_2url' . $i;
$ccom = 'con_com' . $i;
$ccomr = 'con_comr' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url,comment,url2 from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-182 エラーが発生しました。");
($out{$cname},$out{$curl},$out{$ccom},$out{$curl2})=@{$ref->[0]};
$out{$ccomr}=$out{$ccom};
$out{$ccomr} =~ s/\,/ /g;
$i++;
}
if(@num_title[1] ne ''){
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("@num_title[1]の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("@num_title[1]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[1]
$out{'con_name1'}
$out{'con_com1'}
$out{'con_name2'}
$out{'con_com2'}
$out{'con_name3'}
$out{'con_com3'}
EOT
}
if(@num_title[2] ne ''){
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("@num_title[2]の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("@num_title[2]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[2]
$out{'con_name4'}
$out{'con_com4'}
$out{'con_name5'}
$out{'con_com5'}
$out{'con_name6'}
$out{'con_com6'}
EOT
}
if(@num_title[3] ne ''){
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("@num_title[3]の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("@num_title[3]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[3]
$out{'con_name7'}
$out{'con_com7'}
$out{'con_name8'}
$out{'con_comr8'}
$out{'con_name9'}
$out{'con_comr9'}
EOT
}
$html_file = "event_poll02_con_n.html";
}elsif($in{'no'} eq 29) { ##夏娘 夏男
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$out{'list'} = '';
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-183 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("@num_title[1]の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("@num_title[1]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
夏娘部門
$out{'con_name1'}
$out{'con_name2'}
$out{'con_name3'}
EOT
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("@num_title[2]の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("@num_title[2]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
夏男部門
$out{'con_name4'}
$out{'con_name5'}
$out{'con_name6'}
EOT
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("@num_title[3]の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("@num_title[3]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
裏・夏娘部門
$out{'con_name7'}
$out{'con_name8'}
$out{'con_name9'}
EOT
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("@num_title[4]の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("@num_title[4]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
裏・夏男部門
$out{'con_name10'}
$out{'con_name11'}
$out{'con_name12'}
EOT
$html_file = "event_poll02_con_n.html";
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-184 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}elsif ($in{'no'} eq 33){ ##33
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$out{'list'} = '';
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-185 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
if(@num_title[1] ne ''){
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("@num_title[1]の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("@num_title[1]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[1]
$out{'con_name1'}
$out{'con_name2'}
$out{'con_name3'}
EOT
}
if(@num_title[2] ne ''){
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("@num_title[2]の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("@num_title[2]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[2]
$out{'con_name4'}
$out{'con_name5'}
$out{'con_name6'}
EOT
}
if ($in{'poll13'} eq '' || $in{'poll14'} eq '' || $in{'poll15'} eq ''){&err("@num_title[5]の投票先が選択されていません。");}
if ((($in{'poll13'} eq $in{'poll14'}) || ($in{'poll13'} eq $in{'poll15'})) || ($in{'poll14'} eq $in{'poll15'})){&err("@num_title[5]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[5]
$out{'con_name7'}
$out{'con_name8'}
$out{'con_name9'}
EOT
if(@num_title[3] ne ''){
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("@num_title[3]の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("@num_title[3]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[3]
$out{'con_name7'}
$out{'con_name8'}
$out{'con_name9'}
EOT
}
if(@num_title[4] ne ''){
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("@num_title[4]の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("@num_title[4]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[4]
$out{'con_name10'}
$out{'con_name11'}
$out{'con_name12'}
EOT
}
$html_file = "event_poll02_con_n.html";
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-186 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
#####################----------------
}elsif (($in{'no'} >= 23) and ($pol_sheet eq 0)){ ##汎用シート
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。$poll_close2");}
$out{'list'} = '';
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-187 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
if(@num_title[1] ne ''){
if ($in{'poll1'} eq '' || $in{'poll2'} eq '' || $in{'poll3'} eq ''){&err("@num_title[1]の投票先が選択されていません。");}
if ((($in{'poll1'} eq $in{'poll2'}) || ($in{'poll1'} eq $in{'poll3'})) || ($in{'poll2'} eq $in{'poll3'})){&err("@num_title[1]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[1]
$out{'con_name1'}
$out{'con_name2'}
$out{'con_name3'}
EOT
}
if(@num_title[2] ne ''){
if ($in{'poll4'} eq '' || $in{'poll5'} eq '' || $in{'poll6'} eq ''){&err("@num_title[2]の投票先が選択されていません。");}
if ((($in{'poll4'} eq $in{'poll5'}) || ($in{'poll4'} eq $in{'poll6'})) || ($in{'poll5'} eq $in{'poll6'})){&err("@num_title[2]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[2]
$out{'con_name4'}
$out{'con_name5'}
$out{'con_name6'}
EOT
}
if(@num_title[3] ne ''){
if ($in{'poll7'} eq '' || $in{'poll8'} eq '' || $in{'poll9'} eq ''){&err("@num_title[3]の投票先が選択されていません。");}
if ((($in{'poll7'} eq $in{'poll8'}) || ($in{'poll7'} eq $in{'poll9'})) || ($in{'poll8'} eq $in{'poll9'})){&err("@num_title[3]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[3]
$out{'con_name7'}
$out{'con_name8'}
$out{'con_name9'}
EOT
}
if(@num_title[4] ne ''){
if ($in{'poll10'} eq '' || $in{'poll11'} eq '' || $in{'poll12'} eq ''){&err("@num_title[4]の投票先が選択されていません。");}
if ((($in{'poll10'} eq $in{'poll11'}) || ($in{'poll10'} eq $in{'poll12'})) || ($in{'poll11'} eq $in{'poll12'})){&err("@num_title[4]の投票先が重複しています。");}
$out{'list'} .=<<"EOT";
@num_title[4]
$out{'con_name10'}
$out{'con_name11'}
$out{'con_name12'}
EOT
}
$html_file = "event_poll02_con_n.html";
$flg = 0;
$i = 1;
while ($flg eq 0){
$hname = 'poll' . $i;
$cname = 'con_name' . $i;
$curl = 'con_url' . $i;
if ($in{$hname} eq ''){
$flg = 1;
last;
}
$sql = "select name,url from contest_entry where no = $in{'no'} and file_name = '$in{$hname}'";
$sql .= ";";
# &err($sql);
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-188 エラーが発生しました。");
($out{$cname},$out{$curl})=@{$ref->[0]};
$i++;
}
}
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
$sql = "select fame,substr(admission_date,1,10) from character where pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-189 エラーが発生しました。");
($fame,$admission_date)=@{$ref->[0]};
if($uid ne 1717){
if ($fame < $out{'fame_lmit'}){&err("名声値が$out{'fame_lmit'}以上ない学生は投票できません。");}
}
$admission_date =~ s/\-/\//g;
$y = int(substr($adm_date,0,4)) - 1000;
$m = substr($adm_date,4,2);
$d = substr($adm_date,6,2);
if($adm_date ne ''){
if ($admission_date > $adm_date){&err("精霊歴$y年$m月$d日までに入学した学生しか投票できません。");}
}
$sql = "select count(*) from event_poll where no = $in{'no'} and pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-190 エラーが発生しました。");
($cnt)=@{$ref->[0]};
if ($cnt ne '' && $cnt > 0){&err("投票済みです。");}
&out_enc;
&html_out($html_file);
}
#---------------------------------------
# 投票実行
#---------------------------------------
sub poll_reg {
#&err("$in{'poll4'}:$in{'pname4'}");
if ($in{'no'} eq 0){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200908172400"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 1){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200908261500"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 2){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200910062000"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 3){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200911062000"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 4){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "200911300000"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 5){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201001060000"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 6){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > "201002230000"){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} eq 9){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close){&err("投票期間を過ぎています。");}
}
elsif ($in{'no'} >= 7){
if ("$g_year$g_mon$g_mday$g_hour$g_min" > $poll_close2){&err("投票期間を過ぎています。");}
}
if ($pcid eq ''){&err("このコンテンツはキャラクターを選択していないとご利用できません。");}
if (substr($pcid,0,2) eq 'xz'){&err("NPCは投票できません。");}
$sql = "select count(*) from event_poll where no = $in{'no'} and pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-191 エラーが発生しました。");
($cnt)=@{$ref->[0]};
if ($cnt ne '' && $cnt > 0){&err("投票済みです。");}
$sql = "select fame,substr(admission_date,1,10) from character where pcid = '$pcid';";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-192 エラーが発生しました。");
($fame,$admission_date)=@{$ref->[0]};
if($uid ne 1717){
if ($fame < $out{'fame_lmit'}){&err("名声値が$out{'fame_lmit'}以上ない学生は投票できません。");}
}
$admission_date =~ s/\-/\//g;
$y = int(substr($adm_date,0,4)) - 1000;
$m = substr($adm_date,4,2);
$d = substr($adm_date,6,2);
if($adm_date ne ''){
if ($admission_date > $adm_date){&err("精霊歴$y年$m月$d日までに入学した学生しか投票できません。");}
}
$sql = "select count(*) from scenario_member a,scenario b where a.pcid = '$pcid' and a.entry_state = 1 and a.scenario_seq = b.seq and b.state = 0 and b.type not in (3,5);";
$ref = $dbh->selectall_arrayref($sql) or &err("CODE:S-02 エラーが発生しました。");
($scenario_entry_num)=@{$ref->[0]};
if ($scenario_entry_num eq ''){$scenario_entry_num = 0;}
if ($in{'no'} eq 0){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll_pcid'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04 エラーが発生しました。");
$html_file = "event_poll_end.html";
}
elsif ($in{'no'} eq 1){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll_pcid1'},$in{'poll_pcid2'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04 エラーが発生しました。");
$html_file = "event_poll_end_xh01.html";
}
elsif ($in{'no'} eq 2){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'}:$in{'pname1'},$in{'poll2'}:$in{'pname2'},$in{'poll3'}:$in{'pname3'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_xh02.html";
}
elsif ($in{'no'} eq 3){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host,text1,text2) values ($in{'no'},'$pcid','$in{'poll1'}:$in{'pname1'},$in{'poll2'}:$in{'pname2'},$in{'poll3'}:$in{'pname3'},$in{'poll4'}:$in{'pname4'},$in{'poll5'}:$in{'pname5'},$in{'poll6'}:$in{'pname6'},$in{'poll7'}:$in{'pname7'},$in{'poll8'}:$in{'pname8'}',$uid,$fame,$scenario_entry_num,'$ip','$host','$in{'daimei'}','$in{'arasuji'}');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_xh03.html";
}
elsif ($in{'no'} eq 4){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'},$in{'poll13'},$in{'poll14'},$in{'poll15'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_xh04.html";
}
elsif ($in{'no'} eq 5){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_xh05.html";
}
elsif ($in{'no'} eq 6){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_xh06.html";
}
elsif ($in{'no'} eq 7){
$in{'poll1'} = substr($in{'poll1'},10);
$in{'poll2'} = substr($in{'poll2'},10);
$in{'poll3'} = substr($in{'poll3'},10);
$in{'poll4'} = substr($in{'poll4'},10);
$in{'poll5'} = substr($in{'poll5'},10);
$in{'poll6'} = substr($in{'poll6'},10);
$in{'poll7'} = substr($in{'poll7'},10);
$in{'poll8'} = substr($in{'poll8'},10);
$in{'poll9'} = substr($in{'poll9'},10);
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con07.html";
}
elsif ($in{'no'} eq 8){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con08.html";
}
elsif ($in{'no'} eq 9){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll_pcid'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04 エラーが発生しました。");
$html_file = "event_poll_end.html";
}
elsif ($in{'no'} eq 10){
$in{'poll1'} = substr($in{'poll1'},10);
$in{'poll2'} = substr($in{'poll2'},10);
$in{'poll3'} = substr($in{'poll3'},10);
$in{'poll4'} = substr($in{'poll4'},10);
$in{'poll5'} = substr($in{'poll5'},10);
$in{'poll6'} = substr($in{'poll6'},10);
$in{'poll7'} = substr($in{'poll7'},10);
$in{'poll8'} = substr($in{'poll8'},10);
$in{'poll9'} = substr($in{'poll9'},10);
$in{'poll10'} = substr($in{'poll10'},10);
$in{'poll11'} = substr($in{'poll11'},10);
$in{'poll12'} = substr($in{'poll12'},10);
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con10.html";
}
elsif ($in{'no'} eq 11){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con11.html";
}
elsif ($in{'no'} eq 12){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con12.html";
}
elsif ($in{'no'} eq 13){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con13.html";
}
elsif ($in{'no'} eq 14){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con14.html";
}
elsif ($in{'no'} eq 15){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con15.html";
}
elsif ($in{'no'} eq 17){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll_pcid'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04 エラーが発生しました。");
$html_file = "event_poll_end.html";
}
elsif ($in{'no'} eq 16){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con16.html";
}
elsif ($in{'no'} eq 18){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con18.html";
}
elsif ($in{'no'} eq 19){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con19.html";
}
elsif ($in{'no'} eq 20){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con20.html";
}
elsif ($in{'no'} eq 21){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A エラーが発生しました。");
$html_file = "event_poll_end_con21.html";
}
elsif ($in{'no'} eq 22){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'},$in{'poll13'},$in{'poll14'},$in{'poll15'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A22 エラーが発生しました。");
$html_file = "event_poll_end_con$in{'no'}.html";
}
elsif ($in{'no'} eq 33){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll13'},$in{'poll14'},$in{'poll15'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A22 エラーが発生しました。");
if($pol_sheet eq 0){
$html_file = "event_poll_end_con_n.html";
}else{
$html_file = "event_poll_end_con$in{'no'}.html";
}
}
elsif ($in{'no'} >= 23){
$sql = "insert into event_poll (no,pcid,target,uid,fame,scenario_entry_num,ip,host) values ($in{'no'},'$pcid','$in{'poll1'},$in{'poll2'},$in{'poll3'},$in{'poll4'},$in{'poll5'},$in{'poll6'},$in{'poll7'},$in{'poll8'},$in{'poll9'},$in{'poll10'},$in{'poll11'},$in{'poll12'},$in{'poll13'},$in{'poll14'},$in{'poll15'}',$uid,$fame,$scenario_entry_num,'$ip','$host');";
#&err($sql);
$dbh->do($sql) or &err("CODE:RE-04A22 エラーが発生しました。");
if($pol_sheet eq 0){
$html_file = "event_poll_end_con_n.html";
}else{
$html_file = "event_poll_end_con$in{'no'}.html";
}
}
&out_enc;
&html_out($html_file);
## print "Location: ./$html_file\n\n";
}
#---------------------------------------
#
#---------------------------------------
sub img_composite {
use Image::Magick;
use File::Basename;
use File::Copy;
$sql = "select pcid,name,url,file_name,tar_pcid,file_name2,url2,ptn from contest_entry where no = 7;";
$ref = $dbh->selectall_arrayref($sql) or $err=1;
foreach(@$ref) {
($epcid,$ename,$url,$file_name,$tar_pcid,$file_name2,$url2,$ptn)=@{$_};
$m_file = '/home/rexi-jp/public_html/' . substr($url,15);
$s_file = '/home/rexi-jp/public_html/' . substr($url2,15);
$o_file = '/home/rexi-jp/public_html/gx/event/con_image/' . $epcid . '_' . $tar_pcid . '_' . $file_name;
$t_file = "/home/rexi-jp/public_html/gx/event/con_thumbnail/" . $epcid . '_' . $tar_pcid . '_' . $file_name;
$r_url = "./con_thumbnail/" . $epcid . '_' . $tar_pcid . '_' . $file_name;
# 画像を合成する
$back_png = '/home/rexi-jp/public_html/gx/event/png_back.png';
$image = '';
$image2 = '';
$image3 = '';
my $image = Image::Magick->new;
$image->Read($back_png);
if ($ptn eq 1){
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>150, y=>0);
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>0, y=>0);
}
elsif ($ptn eq 2){
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>0, y=>0);
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>150, y=>0);
}
elsif ($ptn eq 3){
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>0, y=>0);
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>150, y=>0);
}
elsif ($ptn eq 4){
my $image3 = Image::Magick->new;
$image3->Read($m_file);
$image->Composite(image=>$image3, compose=>'Over', x=>150, y=>0);
my $image2 = Image::Magick->new;
$image2->Read($s_file);
$image->Composite(image=>$image2, compose=>'Over', x=>0, y=>0);
}
if ($image ne ''){
$image->Write($o_file);
# $image->Write("png:$o_file");
if (!-e $o_file){&err("画像合成に失敗しました。");}
system "convert -resize x400 +profile iptc -quality 100 $o_file $t_file";
}
$dat .=<<"EOT";
EOT
}
&err($dat);
}
#---------------------------------------
#
#---------------------------------------
sub data_move {
$sql = "select no,pcid,name,race,class,birth,sex,lumina,file_name,url,reg_date,state,standpoint,comment,type,file_name2,url2,tar_pcid,ptn,agreement from contest_entry;";
$ref = $dbh->selectall_arrayref($sql) or $err=1;
foreach(@$ref) {
($no,$pcid,$name,$race,$class,$birth,$sex,$lumina,$file_name,$url,$reg_date,$state,$standpoint,$comment,$type,$file_name2,$url2,$tar_pcid,$ptn,$agreement)=@{$_};
$sql2 = "insert into contest_entry2 (no,pcid,name,race,class,birth,sex,lumina,file_name,url,reg_date,state,standpoint,comment,type,file_name2,url2,tar_pcid,ptn,agreement) values (";
$sql2 .= "$no,'$pcid','$name','$race',$class,$birth,$sex,$lumina";
if ($file_name eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",'$file_name'";}
if ($url eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",'$url'";}
$sql2 .= ",'$reg_date',$state";
if ($standpoint eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",$standpoint";}
if ($comment eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",'$comment'";}
$sql2 .= ",$type";
if ($file_name2 eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",'$file_name2'";}
if ($url2 eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",'$url2'";}
if ($tar_pcid eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",'$tar_pcid'";}
if ($ptn eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",$ptn";}
if ($agreement eq ''){$sql2 .= ",NULL";}
else{$sql2 .= ",$agreement";}
$sql2 .= ");";
$dbh->do($sql2) or &err("CODE:RE-04A エラーが発生しました。");
}
&err('END');
}
#---------------------------------------
# 文字乗せ
#---------------------------------------
sub text_set {
$img_dat = $_[0];
$text = $_[1];
$font = $_[2];
$point_size = $_[3];
$point_x = $_[4];
$point_y = $_[5];
$enc = $_[6];
if ($enc eq ''){
$text = jcode($text)->utf8;
$img_dat->Annotate(
text=>$text,
fill=>'#000000',
font=>'/home/rexi-jp/public_html/gx_test/font/KozGoPro-Medium.otf',
pointsize=>$point_size,
x=>$point_x,
y=>$point_y,
); # 文字
}
else{
$text = jcode($text)->utf8;
$img_dat->Annotate(
text=>$text,
encoding=>$enc,
fill=>'#000000',
font=>'/home/rexi-jp/public_html/gx_test/font/KozGoPro-Medium.otf',
pointsize=>$point_size,
x=>$point_x,
y=>$point_y,
); # 文字
}
return $img_dat;
}