NEWS
新着情報

"; define('COMMENTS_PER_PAGE' , 5); if (preg_match('/^[1-9][0-9]*$/' , $_GET['page'])) { $page = (int)$_GET['page']; } else { $page = 1; } error_reporting(E_ALL & ~E_NOTICE); try { $dbh = new PDO("sqlite:./data/btdb.db"); } catch (PDOException $e) { echo $e->getMessage(); exit; } $offset = COMMENTS_PER_PAGE * ($page - 1); $sql = "SELECT * FROM top_info ORDER BY day DESC limit " .$offset. "," .COMMENTS_PER_PAGE; $comments = array(); foreach ($dbh->query($sql) as $row) { array_push($comments, $row); } $total = $dbh->query("SELECT COUNT(*) FROM top_info")->fetchColumn(); $totalPages = ceil($total / COMMENTS_PER_PAGE); foreach ($comments as $row) { $day = htmlspecialchars($row['day']); $days = date('Y/m/d', strtotime($day)); $title = htmlspecialchars_decode($row['title']); $coments = htmlspecialchars_decode($row['coments']); $coments = nl2br($coments); $img01 = htmlspecialchars($row['img01']); $img02 = htmlspecialchars($row['img02']); $img03 = htmlspecialchars($row['img03']); echo "
" .$days; echo "
"; echo "
" .$title; echo "
" .$coments; echo "
"; $imgck1 = "./upimages/$day/$img01"; if(file_exists($imgck1)) { echo ""; } else { echo ""; } $imgck2 = "./upimages/$day/$img02"; if(file_exists($imgck2)) { echo ""; } else { echo ""; } $imgck3 = "./upimages/$day/$img03"; if(file_exists($imgck3)) { echo ""; } else { echo ""; } echo "
"; } echo ""; ?>

ページのトップへ戻る