<?php require_once('includes/config.php'); $stmt = $db->prepare('SELECT catID,catTitle FROM blog_cats WHERE catSlug = :catSlug'); $stmt->bindValue(':catSlug', $_GET['id'], PDO::PARAM_INT); $stmt->execute(); $row = $stmt->fetch(); if (!isset($row['catID']) || empty($row['catID'])) { header('Location: ./'); exit(); } elseif (!filter_var($row['catID'], FILTER_VALIDATE_INT)) { header('Location: ./'); exit(); } $pagetitle = 'Catégorie : '.html($row['catTitle']); include_once('includes/header.php'); define("_BBC_PAGE_NAME", $pagetitle); define("_BBCLONE_DIR", "bbclone/"); define("COUNTER", _BBCLONE_DIR."mark_page.php"); if (is_readable(COUNTER)) include_once(COUNTER); ?> <body> <div id="container"> <?php include_once('includes/header-logo.php'); include_once('includes/nav.php'); ?> <div id="body"> <div id="content"> <?php include_once('includes/ariane.php'); ?> <br /> <h3><?php echo html($row['catTitle']); ?></h3> <?php try { $pages = new Paginator('5','p'); $stmt = $db->prepare('SELECT blog_posts_seo.postID FROM blog_posts_seo, blog_post_cats WHERE blog_posts_seo.postID = blog_post_cats.postID AND blog_post_cats.catID = :catID'); $stmt->bindValue(':catID', $row['catID'], PDO::PARAM_INT); $stmt->execute(); $count = $stmt->rowCount(); if (empty($count)) { echo '<p>Aucun torrent dans cette catégorie.</p>'; } //pass number of records to $pages->set_total($stmt->rowCount()); $stmt = $db->prepare(' SELECT blog_posts_seo.postID, blog_posts_seo.postHash, blog_posts_seo.postTitle, blog_posts_seo.postAuthor, blog_posts_seo.postSlug, blog_posts_seo.postLink, blog_posts_seo.postDesc, blog_posts_seo.postTaille, blog_posts_seo.postDate, blog_posts_seo.postViews, blog_posts_seo.postImage FROM blog_posts_seo, blog_post_cats WHERE blog_posts_seo.postID = blog_post_cats.postID AND blog_post_cats.catID = :catID ORDER BY postID DESC '.$pages->get_limit()); $stmt->bindValue(':catID', $row['catID'], PDO::PARAM_INT); $stmt->execute(); while($row = $stmt->fetch()){ echo '<fieldset>'; echo '<span style="font-weight: bold; font-size: 18px;"><a style="text-decoration: none;" href="'.html($row['postSlug']).'">'.html($row['postTitle']).'</a></span>'; echo '<br /><span style="font-size: 12px;">Posté le '.date_fr('l j F Y à H:i:s', strtotime($row['postDate'])).' par '; $stmt2 = $db->prepare('SELECT catTitle, catSlug FROM blog_cats, blog_post_cats WHERE blog_cats.catID = blog_post_cats.catID AND blog_post_cats.postID = :postID'); $stmt2->bindValue(':postID', $row['postID'], PDO::PARAM_INT); $stmt2->execute(); $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC); echo html($row['postAuthor']).' dans '; $links = array(); foreach ($catRow as $cat) { $links[] = "<a href='c-".html($cat['catSlug'])."'>".html($cat['catTitle'])."</a>"; } echo implode(", ", $links); echo '</span>'; echo '<p style="text-align:justify; font-size:12px;">'; echo '<img src="'.$WEB_IMAGES_TORRENTS.$row['postImage'].'" alt="'.$row['postTitle'].'" style="float:left; margin-right:15px; margin-bottom:10px; margin-top:6px; border: 1px solid #C0C0C0; max-width:70px; max-height:70px;" />'; echo bbcode($row['postDesc']); echo '</p>'; echo '</fieldset>'; } echo '<br /><br />'; echo $pages->page_links('c-'.html($_GET['id']).'&'); } catch(PDOException $e) { echo $e->getMessage(); } ?> </div> <?php include_once('sidebar.php'); ?> <div class="clear"></div> </div> </div> <div id="footer"> <?php include_once('includes/footer.php'); ?> </div> </body> </html>