#!/usr/bin/perl use DBI; use POSIX qw(strftime); use FileHandle; require "kanlib.pl"; %formdata=(); kanlib::ReadData(*data); kanlib::ParseData(*data,*formdata); if (!$formdata{'ref'}){ $mainurl = "/y28lifestyle/Y28-Ladies/news/news.htm"; } else { $mainurl = "/y28lifestyle/Y28-Ladies/news/news_contents.htm"; } $news{'c_curdate'} = strftime "%Y", localtime; &Get_Settings; $dbh=DBI->connect('dbi:mysql:y28news:203.77.128.78',"newsuser","newspass") ; $ref =$formdata{'ref'}; $sql = qq {select ref,output_date, output_time, heading,summary,category from news where category="28佳人_流行情報" and schtime <= now() and online = "Y" order by output_date desc, output_time desc limit 12 }; $sth=$dbh->prepare($sql); $sth->execute(); $fashion=$sth->fetchall_arrayref; $row = $sth->rows; $sth->finish(); $news{'heading1'} = $$fashion[0][3]; $news{'heading2'} = $$fashion[1][3]; $news{'heading3'} = $$fashion[2][3]; $news{'contents1'} = $$fashion[0][4]; $news{'contents2'} = $$fashion[1][4]; $news{'contents3'} = $$fashion[2][4]; $news{'ref1'} = $$fashion[0][0]; $news{'ref2'} = $$fashion[1][0]; $news{'ref3'} = $$fashion[2][0]; $templist=kanlib::proctemplate($mainurl,'C2'); for (0..@$fashion-1) { %temp = ("ref",$$fashion[$_][0],"output_date",$$fashion[$_][1],"output_time",$$fashion[$_][2],"heading",$$fashion[$_][3],"summary",$$fashion[$_][4],"category",$$fashion[$_][5]); $templist2 = $templist; while ($templist2 =~ /KANNET\(([^\)]+)/i) { my $tmp = $temp{$1}; if (defined($tmp)) {$templist2 =~ s/KANNET\($1\)/$tmp/ig;} else {$templist2 =~ s/KANNET\($1\)//ig;} } $news{'RESULT_C2'} .= $templist2; } $sql = qq {select ref,heading,contents,keywords from news where category="28佳人_流行情報" and schtime <= now() and online = "Y" and ref="$ref" }; $sth=$dbh->prepare($sql); $sth->execute(); $health=$sth->fetchall_arrayref; $row = $sth->rows; $sth->finish(); $news{'ref'} = $$health[0][0]; $news{'heading'} = $$health[0][1]; $news{'contents'} = $$health[0][2]; if ($formdata{'ref'}){ $key = $$health[0][3]; } else { $key = $formdata{'search'}; } $sql = qq {select ref,output_date,heading from news where category="28佳人_流行情報" and keywords LIKE "%$key%" and ref <> "$formdata{'ref'}" AND keywords <> "" and schtime <= now() and online = "Y" order by output_date desc, output_time desc limit 100 }; $sth=$dbh->prepare($sql); $sth->execute(); $relate=$sth->fetchall_arrayref; $row = $sth->rows; $sth->finish(); $templist=kanlib::proctemplate($mainurl,'RELATE'); for (0..@$relate-1) { %temp = ("ref",$$relate[$_][0],"output_date",$$relate[$_][1],"heading",$$relate[$_][2]); $templist2 = $templist; while ($templist2 =~ /KANNET\(([^\)]+)/i) { my $tmp = $temp{$1}; if (defined($tmp)) {$templist2 =~ s/KANNET\($1\)/$tmp/ig;} else {$templist2 =~ s/KANNET\($1\)//ig;} } $news{'RESULT_RELATE'} .= $templist2; } $news{'search'}=$formdata{'search'}; kanlib::write_htm($mainurl,*news); $dbh->disconnect(); exit; sub Get_Settings { ################################################### ##Get General Setting my $filename = "e05_general_setting.txt"; open (OUTFILE, "$filename") || Error_Die("can't open $filename");; @readcontent = ; foreach $error_key (1..500) { foreach $key (@readcontent) { @read_setting = split/\=\=\=/,$key; $name = $read_setting[0]; $name =~s/\n//; $value = $read_setting[1]; $value =~s/\n//; $setting{"$name"}= qq{$value}; $setting_eng{"$value"}= qq{$name}; } } close OUTFILE; }