EOT
}
}
}
if ($list_bookmark ne ''){
$out{'list_bookmark'} =<<"EOT";
$list_bookmark
EOT
}
#人気順
$i = 0;
$k = 0;
# if ($uid ne ''){
# $sql2 = "select count(*) from bookmark where usr_seq = $uid;";
# $ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。");
# ($cnt3)=@{$ref2->[0]};
# }
# if ($cnt3 eq ""){$cnt3 = 0;}
# $sql = "select z.id,z.name,z.comment from ";
# $sql .= "(select a.crid,count(*) as cnt from (select usr_seq,crid from bookmark) a,(select usr_seq from reservation where result = 1 group by usr_seq) b where a.usr_seq = b.usr_seq group by a.crid) x,";
# $sql .= "(select crid,count(*) as jcnt from reservation where result = 1 and state = 0 group by crid) y,";
# $sql .= "(select crid,count(*) as ncnt from reservation where state = 0 and delivered_result = 3 and delivered_date >= now() + '-3 months' group by crid) y2,";
# $sql .= "creator z where x.crid = y.crid and x.crid = z.id and x.crid = y2.crid and y2.ncnt > 0 order by x.cnt desc,y.jcnt desc limit 5;";
$sql = "select z.crid,cre.name,cre.comment,x.amt,y.bmt,x.amt + y.bmt as total from ";
$sql .= "(select crid,sum(amount) / 1000 as amt from reservation where result = 1 and delivered_result = 3 and delivered_result_date >= now() + '-6 months' and state = 0 group by crid) x,";
$sql .= "(select a.crid,count(*) * 10 as bmt from bookmark a,(select usr_seq from reservation where result = 1 and delivered_result = 3 and delivered_result_date >= now() + '-6 months' and state = 0 group by usr_seq) b where a.usr_seq = b.usr_seq group by a.crid order by count(*) desc) y,";
$sql .= "(select crid,count(*) as ncnt from reservation where state = 0 and delivered_result = 3 and delivered_date >= now() + '-3 months' group by crid) z,";
$sql .= "creator cre ";
$sql .= "where x.crid = y.crid and x.crid = z.crid and x.crid = cre.id and cre.state = 0 and cre.open_stat = 0 ";
$sql .= "order by x.amt + y.bmt desc,cre.ins_date limit 6;";
$ref = $dbh->selectall_arrayref($sql) or &stars_err("エラーが発生しました。".$dbh->errstr);
foreach(@$ref) {
($id,$name,$comment)=@{$_};
$comment = &del_tag($comment);
$comment = &newline_remove($comment);
$len1 = length ($comment);
if ($len1 > 180){
$comment = substr($comment,0,178);
if ($comment =~ /\x8F$/ or $comment =~ tr/\x8E\xA1-\xFE// % 2) {
$comment = substr($comment,0,-1);
}
$comment .= "…"
}
if ($comment eq ''){$comment = " ";}
#看板サムネイル
$sql = "select illust from sample where id = '$id' and gid = -1 and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &stars_err("エラーが発生しました。");
($kanban)=@{$ref->[0]};
if ($kanban eq ''){
$sql2 = "select type from creator where id = '$id';";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。".$dbh->errstr);
($ctype)=@{$ref2->[0]};
if($ctype eq 1){
$kanban = "http://rexi.jp/images/stars/st_defobana_v.gif";
}else{
$kanban = "http://rexi.jp/images/stars/st_defobana.gif";
}
}
else{$kanban = "http://rexi.jp/stars/sample/$id/sum_$kanban";}
#アイコン
$sql = "select illust from sample where id = '$id' and gid = -2 and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &stars_err("エラーが発生しました。");
($icon)=@{$ref->[0]};
if ($icon eq ''){
$sql2 = "select type from creator where id = '$id';";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。".$dbh->errstr);
($ctype)=@{$ref2->[0]};
if($ctype eq 1){
$icon = "http://rexi.jp/images/stars/st_icon_sample_v.gif";
}else{
$icon = "http://rexi.jp/images/stars/st_icon_sample.gif";
}
## $icon = "http://rexi.jp/images/stars/st_icon_sample.gif";
}
else{$icon = "http://rexi.jp/stars/sample/$id/$icon";}
#最新納品日
$last_deli = &last_delib($id);
#総納品枚数
$total_deli = &total_delib($id);
##AGCクリエーター
$sql_agc = "select agc_flg,type,sex from creator where id = '$id';";
$ref_agc = $dbh->selectall_arrayref($sql_agc) or &stars_err("CODE AGC0X:エラーが発生しました。");
($agc_flg,$ctype,$sex)=@{$ref_agc->[0]};
if($agc_flg eq '1'){
$agc_mark = <<"EOT";
EOT
}else{
$agc_mark = " ";
}
if($ctype eq 1){ ##ボイス
if($sex eq '男性'){
$type_icon = <<"EOT";
男性
EOT
}elsif($sex eq '女性'){
$type_icon = <<"EOT";
女性
EOT
}else{
$type_icon = ''
}
}else{
$type_icon = <<"EOT";
EOT
}
$out{'list_fv'} .=<<"EOT";
EOT
$i = 0;
}
$k++;
}
if ($k >= 15){last;}
}
&reserve_cr_list;
&out_enc;
&html_out("stars_index.html");
}
#---------------------------------------
# ソート表示
#---------------------------------------
sub sort_list {
if ($in{'page'} eq ''){$in{'page'} = 1;}
$start_cnt = ($in{'page'} - 1) * $max_cnt;
if ($uid ne ''){
$sql2 = "select count(*) from bookmark where usr_seq = $uid;";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。");
($cnt3)=@{$ref2->[0]};
}
if ($in{'sort'} eq 0){
print "Location: $mycgi\n\n";
exit;
}
elsif ($in{'sort'} eq 1){
#予約可能
$out{'img'} = "http://rexi.jp/images/stars/st_title_yoyaku.gif";
$out{'title'} = "予約受付中のクリエーター";
$out{'title_img'} = '';
$sql_c = "select count(*) from creator a,accept_frame b,(select x.crid,sum(x.flg) as flg from accept_setting x,goods y where x.flg > 0 and x.pdid = y.pdid and y.state = 0 group by x.crid) c where a.state = 0 and a.id != 'rexi' and a.id != 'system' and a.id = b.crid and b.num > 0 and b.crid = c.crid and (type is null or type =0 or (type =1 and sex is not NULL));";
$sql = "select a.id,a.name,a.comment from creator a,accept_frame b,(select x.crid,sum(x.flg) as flg from accept_setting x,goods y where x.flg > 0 and x.pdid = y.pdid and y.state = 0 group by x.crid) c where a.state = 0 and a.open_stat = 0 and a.id != 'rexi' and a.id != 'system' and a.id = b.crid and b.num > 0 and b.crid = c.crid and (type is null or type =0 or (type =1 and sex is not NULL))
order by last_update desc";
$out{'s1'} = "selected";
}
elsif ($in{'sort'} eq 3){
#新人順
$out{'img'} = "http://rexi.jp/images/stars/st_title_newcome.gif";
$out{'title'} = "新規クリエーター順";
$out{'title_img'} = '';
$sql_c = "select count(*) from creator where id != 'rexi' and id != 'system' and state = 0 and open_stat = 0 and (type is null or type =0 or (type =1 and sex is not NULL)) and substr(id,1,3) != 'agc';";
$sql = "select id,name,comment from creator where id != 'rexi' and id != 'system' and state = 0 and open_stat = 0 and (type is null or type =0 or (type =1 and sex is not NULL)) and substr(id,1,3) != 'agc' order by ins_date desc";
$out{'s3'} = "selected";
}
elsif ($in{'sort'} eq 'all'){
#新人順
# $out{'img'} = "http://rexi.jp/images/stars/st_title_newcome.gif";
# $out{'title'} = "新規クリエーター順";
# $out{'title_img'} = '';
$sql_c = "select count(*) from creator where id != 'rexi' and id != 'system' and state = 0 and open_stat = 0 and (type is null or type =0 or (type =1 and sex is not NULL)) and substr(id,1,3) != 'agc';";
$sql = "select id,name,comment from creator where id != 'rexi' and id != 'system' and state = 0 and open_stat = 0 and (type is null or type =0 or (type =1 and sex is not NULL)) and substr(id,1,3) != 'agc' order by ins_date";
# $out{'s3'} = "selected";
}
elsif ($in{'sort'} eq 4){
#更新順
$out{'img'} = "http://rexi.jp/images/stars/st_title_koushin.gif";
$out{'title'} = "更新順";
$out{'title_img'} = '';
$sql_c = "select count(*) from creator where id != 'rexi' and id != 'system' and state = 0 and open_stat=0 and (type is null or type =0 or (type =1 and sex is not NULL)) and substr(id,1,3) != 'agc' ;";
$sql = "select id,name,comment from creator where id != 'rexi' and id != 'system' and state = 0 and open_stat=0 and (type is null or type =0 or (type =1 and sex is not NULL)) and substr(id,1,3) != 'agc' order by last_update desc";
$out{'s4'} = "selected";
}
elsif ($in{'sort'} eq 2){
#人気順
$out{'img'} = "../images/spacer.gif";
$out{'title'} = "人気順";
$out{'title_img'} = '';
# $sql_c = "select count(*) from ";
# $sql_c .= "(select crid,sum(amount) / 1000 as amt from reservation where result = 1 and delivered_result = 3 and delivered_result_date >= now() + '-6 months' and state = 0 group by crid) x,";
# $sql_c .= "(select a.crid,count(*) * 10 as bmt from bookmark a,(select usr_seq from reservation where result = 1 and delivered_result = 3 and delivered_result_date >= now() + '-6 months' and state = 0 group by usr_seq) b where a.usr_seq = b.usr_seq group by a.crid order by count(*) desc) y,";
# $sql_c .= "(select crid,count(*) as ncnt from reservation where state = 0 and delivered_result = 3 group by crid) z,";
# $sql_c .= "creator cre ";
# $sql_c .= "where x.crid = y.crid and x.crid = z.crid and x.crid = cre.id and cre.state = 0 ";
$sql_c = "select count(*) from cre1 a,cre2 b where a.id = b.id and a.id != 'rexi' and a.state = 0 and b.state = 0 and substr(a.id,1,3) != 'agc';";
# $sql = "select z.crid,cre.name,cre.comment,x.amt,y.bmt,x.amt + y.bmt as total from ";
# $sql .= "(select crid,sum(amount) / 1000 as amt from reservation where result = 1 and delivered_result = 3 and delivered_result_date >= now() + '-6 months' and state = 0 group by crid) x,";
# $sql .= "(select a.crid,count(*) * 10 as bmt from bookmark a,(select usr_seq from reservation where result = 1 and delivered_result = 3 and delivered_result_date >= now() + '-6 months' and state = 0 group by usr_seq) b where a.usr_seq = b.usr_seq group by a.crid order by count(*) desc) y,";
# $sql .= "(select crid,count(*) as ncnt from reservation where state = 0 and delivered_result = 3 group by crid) z,";
# $sql .= "creator cre ";
# $sql .= "where x.crid = y.crid and x.crid = z.crid and x.crid = cre.id and cre.state = 0 ";
# $sql .= "order by x.amt + y.bmt desc,cre.ins_date";
$sql = "select a.id,a.name,b.comment,a.amt,b.bmt,(a.amt + b.bmt) from cre1 a,cre2 b where a.id = b.id and a.id != 'rexi' and a.state = 0 and b.state = 0 and substr(a.id,1,3) != 'agc' order by a.amt + b.bmt desc,b.ins_date";
$out{'s2'} = "selected";
}elsif($in{'sort'} eq 'illust'){
$s{$in{'sort'}} = 'selected';
$sql_c = "select count(*) from creator where id != 'rexi' and id != 'system' and substr(id,1,3) != 'agc' and state = 0 and open_stat = 0 and (type is NULL or type=0 ) ;";
$sql = "select id,name,comment from creator where id != 'rexi' and id != 'system' and substr(id,1,3) != 'agc' and state = 0 and open_stat = 0 and (type is NULL or type=0 ) order by last_update desc";
}elsif($in{'sort'} eq 'voice'){
$s{$in{'sort'}} = 'selected';
$sql_c = "select count(*) from creator where id != 'rexi' and id != 'system' and substr(id,1,3) != 'agc' and state = 0 and open_stat = 0 and type = 1;";
$sql = "select id,name,comment from creator where id != 'rexi' and id != 'system' and substr(id,1,3) != 'agc' and state = 0 and open_stat = 0 and type = 1 order by last_update desc";
} else{
if($in{'sort'} eq 'Z01'){
$insort = 'G01';
}else{
$insort = $in{'sort'};
}
if($in{'sort'} eq 'Z20'){
$max_cnt = 38;
}
#商品別
$out{'img'} = "http://rexi.jp/images/spacer.gif";
if($in{'sort'} eq 'Z20'){ ##test
$sql = "select pdname,plural from goods where pdid = '$in{'sort'}' order by pdid;";
}else{
$sql = "select pdname,plural from goods where pdid = '$in{'sort'}' and state = 0 order by pdid;";
}
$ref = $dbh->selectall_arrayref($sql) or &stars_err("CODE 01:エラーが発生しました。");
($pdname,$plural)=@{$ref->[0]};
$out{'title'} = $pdname;
$out{'title_img'} = "
$pdname
";
$s{$in{'sort'}} = 'selected';
if($in{'sort'} eq 'Z20'){ ##test
$sql_c = "select count(*) from creator a,(select x.crid from accept_frame x,accept_setting y where x.num > 0 and x.crid = y.crid and y.flg = 1 and y.pdid = '$insort') b where a.id = b.crid and a.id != 'rexi' and a.id != 'system' and state = 0 and open_stat = 0;";
$sql = "select a.id,a.name,a.comment from creator a where substr(a.id,1,3) = 'agc' and a.id != 'rexi' and a.id != 'system' and a.state = 0 and a.open_stat = 0 order by a.id asc";
}else{
$sql_c = "select count(*) from creator a,(select x.crid from accept_frame x,accept_setting y where x.num > 0 and x.crid = y.crid and y.flg = 1 and y.make_days is not null and y.make_days > 0 and y.pdid = '$insort') b where a.id = b.crid and a.id != 'rexi' and a.id != 'system' and state = 0 and open_stat = 0;";
$sql = "select a.id,a.name,a.comment from creator a,(select x.crid from accept_frame x,accept_setting y where x.num > 0 and x.crid = y.crid and y.flg = 1 and y.pdid = '$insort') b,accept_setting c where a.id = b.crid and a.id != 'rexi' and a.id != 'system' and a.state = 0 and a.open_stat = 0 and a.id = c.crid and c.pdid = '$insort' and c.make_days is not null and c.make_days > 0 order by a.last_update desc";
}
}
if ($in{'sort'} ne 'all'){
$sql .= " offset $start_cnt limit $max_cnt;";
}
$ref = $dbh->selectall_arrayref($sql) or &stars_err("CODE 02:エラーが発生しました。$sql");
$cnt = 0;
$set_cnt = 0;
foreach(@$ref) {
($id,$name,$comment,$amt,$bmt,$tot)=@{$_};
$flg = 0;
$comment =~ s/\n//g;
#サンプルチェック
$sql2 = "select count(*) from sample where id = '$id' and state = 0;";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("CODE 03:エラーが発生しました。");
($cnt)=@{$ref2->[0]};
if ($cnt eq ''){$cnt = 0;}
#コメントが記入されている、またはサンプルがあがっているクリエーターのみ表示
if ($comment ne ''){$flg = 1;}
if ($cnt > 0){$flg = 1;}
if ($flg eq 1){
$comment = &del_tag($comment);
$comment =~ s/ //g;
$comment =~ s/ //g;
$comment = &newline_remove($comment);
$len1 = length ($comment);
if ($len1 > 180){
$comment = substr($comment,0,178);
if ($comment =~ /\x8F$/ or $comment =~ tr/\x8E\xA1-\xFE// % 2) {
$comment = substr($comment,0,-1);
}
$comment .= "…"
}
if ($comment eq ''){$comment = " ";}
if ($uid eq ''){$btn = "";}
else{
if ($uid ne ''){
$sql2 = "select count(*) from bookmark where usr_seq = $uid and crid = '$id';";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。");
($cnt2)=@{$ref2->[0]};
}
if ($cnt2 eq ""){$cnt2 = 0;}
if ($cnt3 >= $bookmark_able){$btn = "";}
elsif ($cnt2 > 0){$btn = "";}
else{
$btn =<<"EOT";
登録
EOT
}
}
#複数
$plural_str = '';
if ($plural ne '' && $plural > 0){
$sql2 = "select plural_num from accept_setting where crid = '$id' and pdid = '$in{'sort'}';";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。");
($plural_num)=@{$ref2->[0]};
$plural_str = "($plural_num人)";
}
#看板サムネイル
$sql = "select illust from sample where id = '$id' and gid = -1 and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &stars_err("エラーが発生しました。");
($kanban)=@{$ref->[0]};
if ($kanban eq ''){
$sql2 = "select type from creator where id = '$id';";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。".$dbh->errstr);
($ctype)=@{$ref2->[0]};
if($ctype eq 1){
$kanban = "http://rexi.jp/images/stars/st_defobana_v.gif";
}else{
$kanban = "http://rexi.jp/images/stars/st_defobana.gif";
}
}
else{$kanban = "http://rexi.jp/stars/sample/$id/sum_$kanban";}
#アイコン
$sql = "select illust from sample where id = '$id' and gid = -2 and state = 0;";
$ref = $dbh->selectall_arrayref($sql) or &stars_err("エラーが発生しました。");
($icon)=@{$ref->[0]};
if ($icon eq ''){
$sql2 = "select type from creator where id = '$id';";
$ref2 = $dbh->selectall_arrayref($sql2) or &stars_err("エラーが発生しました。".$dbh->errstr);
($ctype)=@{$ref2->[0]};
if($ctype eq 1){
$icon = "http://rexi.jp/images/stars/st_icon_sample_v.gif";
}else{
$icon = "http://rexi.jp/images/stars/st_icon_sample.gif";
}
## $icon = "http://rexi.jp/images/stars/st_icon_sample.gif";
}
else{$icon = "http://rexi.jp/stars/sample/$id/$icon";}
#最新納品日
$last_deli = &last_delib($id);
#総納品枚数
$total_deli = &total_delib($id);
##AGCクリエーター
$sql_agc = "select agc_flg,type,sex from creator where id = '$id';";
$ref_agc = $dbh->selectall_arrayref($sql_agc) or &stars_err("CODE AGC0X:エラーが発生しました。");
($agc_flg,$ctype,$sex)=@{$ref_agc->[0]};
if($agc_flg eq '1'){
$agc_mark = <<"EOT";
EOT
}else{
$agc_mark = " ";
}
if($ctype eq 1){ ##ボイス
if($sex eq '男性'){
$type_icon = <<"EOT";
男性
EOT
}elsif($sex eq '女性'){
$type_icon = <<"EOT";
女性
EOT
}else{
$type_icon = ''
}
}else{
$type_icon = <<"EOT";
EOT
}
# if ($cnt >= $start_cnt){
if ($uid eq 2 && $in{'sort'} eq 2){$name .= '/' . $amt . "," . $bmt . '=' . $tot;}
if ($in{'sort'} eq 'all'){
$out{'body'} .=<<"EOT";