#!/usr/bin/perl require '/var/www/vhosts/aosemi.com/private/info.dat'; require './admin/cgi_lib/temp.pl'; use CGI; use lib './admin/cgi_lib/lib'; use Jcode; use Encode; use utf8; use DBI; use Time::Local; use CGI::Carp qw(fatalsToBrowser); $in = new CGI; #POSTエラー if($ENV{'REQUEST_METHOD'} eq 'POST'){ print "Content-type:text/plain;\n\nerror"; exit; } #データ初期化 $html=''; my $current=time; #データベース接続 my $db = DBI->connect("dbi:SQLite:dbname=$db_name","","", {}); $db->do("set names utf8"); my $sth = $db->prepare("SELECT * FROM news ORDER BY CAST(news_date AS SIGNED) DESC"); $sth->execute(); while($row=$sth->fetchrow_hashref()){ my $news_date=$row->{'news_date'}; my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime($news_date); $mon++; $year = $year + 1900; my $news_comment=&getData($row->{'news_comment'}); my $new_icon=''; if($news_date >= $current-(60*60*24*30)){ $new_icon='NEW
'; } $html.=<<"diSEMBOWELMENT"; ${year}年${mon}月${mday}日 $new_icon$news_comment diSEMBOWELMENT } $sth->finish; #データベース接続解除 $db->disconnect; #html my $html=<<"diSEMBOWELMENT"; $html
diSEMBOWELMENT #表示 print "Content-type:text/html;\n\n"; print encode('utf-8',"$html"); __END__