403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /laragon4/www/bpkd_/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /laragon4/www/bpkd_//detail-artikel_.php
<?php
/**
 * Halaman Detail Artikel
 * Dengan prefix "art-" untuk semua class CSS
 */

require_once 'includes/init.php';

// Aktifkan error reporting untuk debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);

// =====================================================
// HANDLE PARAMETER
// =====================================================
$hash = isset($_GET['hash']) ? $_GET['hash'] : '';
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$slug = isset($_GET['slug']) ? $_GET['slug'] : '';

// Jika tidak ada parameter, redirect ke berita
if (empty($hash) && $id <= 0 && empty($slug)) {
    header("Location: berita.php");
    exit;
}

$article = null;

// =====================================================
// CARI BERDASARKAN HASH (PRIORITAS UTAMA)
// =====================================================
if (!empty($hash)) {
    $hash_escaped = mysqli_real_escape_string($conn, $hash);
    $query = "SELECT a.*, c.name as category_name, c.slug as category_slug, 
                     u.full_name as author_name, u.avatar as author_avatar
              FROM articles a 
              LEFT JOIN categories c ON a.category_id = c.id 
              LEFT JOIN users u ON a.author_id = u.id 
              WHERE a.url_hash = '$hash_escaped' AND a.status = 'published'";
    
    $result = $conn->query($query);
    
    if ($result && $result->num_rows > 0) {
        $article = $result->fetch_assoc();
    }
}

// =====================================================
// CARI BERDASARKAN ID
// =====================================================
if (!$article && $id > 0) {
    $query = "SELECT a.*, c.name as category_name, c.slug as category_slug, 
                     u.full_name as author_name, u.avatar as author_avatar
              FROM articles a 
              LEFT JOIN categories c ON a.category_id = c.id 
              LEFT JOIN users u ON a.author_id = u.id 
              WHERE a.id = $id AND a.status = 'published'";
    
    $result = $conn->query($query);
    
    if ($result && $result->num_rows > 0) {
        $article = $result->fetch_assoc();
    }
}

// =====================================================
// CARI BERDASARKAN SLUG
// =====================================================
if (!$article && !empty($slug)) {
    $slug_escaped = mysqli_real_escape_string($conn, $slug);
    $query = "SELECT a.*, c.name as category_name, c.slug as category_slug, 
                     u.full_name as author_name, u.avatar as author_avatar
              FROM articles a 
              LEFT JOIN categories c ON a.category_id = c.id 
              LEFT JOIN users u ON a.author_id = u.id 
              WHERE a.slug = '$slug_escaped' AND a.status = 'published'";
    
    $result = $conn->query($query);
    
    if ($result && $result->num_rows > 0) {
        $article = $result->fetch_assoc();
    }
}

// =====================================================
// JIKA ARTIKEL TIDAK DITEMUKAN
// =====================================================
if (!$article) {
    ?>
    <!DOCTYPE html>
    <html>
    <head>
        <title>Artikel Tidak Ditemukan</title>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
        <style>
            * { margin: 0; padding: 0; box-sizing: border-box; }
            body { font-family: 'Inter', sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; }
            .art-error-container { max-width: 600px; margin: 100px auto; padding: 0 20px; }
            .art-error-card { background: white; border-radius: 24px; padding: 50px 40px; text-align: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
            .art-error-icon { font-size: 5rem; color: #ef4444; margin-bottom: 20px; }
            .art-error-title { font-size: 1.75rem; font-weight: 700; color: #1e293b; margin-bottom: 12px; }
            .art-error-desc { color: #64748b; margin-bottom: 30px; line-height: 1.6; }
            .art-error-btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 28px; background: #3b82f6; color: white; text-decoration: none; border-radius: 40px; font-weight: 600; transition: all 0.3s; }
            .art-error-btn:hover { background: #2563eb; transform: translateY(-3px); gap: 15px; }
        </style>
    </head>
    <body>
        <div class="art-error-container">
            <div class="art-error-card">
                <div class="art-error-icon">
                    <i class="fas fa-search"></i>
                </div>
                <h1 class="art-error-title">Artikel Tidak Ditemukan</h1>
                <p class="art-error-desc">Maaf, artikel yang Anda cari tidak tersedia atau telah dihapus.</p>
                <a href="berita.php" class="art-error-btn">
                    <i class="fas fa-arrow-left"></i> Kembali ke Berita
                </a>
            </div>
        </div>
    </body>
    </html>
    <?php
    exit;
}

// Update views
$conn->query("UPDATE articles SET views = views + 1 WHERE id = " . $article['id']);

// Get related articles (artikel terkait berdasarkan kategori)
$related_query = "SELECT id, title, slug, url_hash, featured_image, published_at 
                  FROM articles 
                  WHERE category_id = " . $article['category_id'] . " 
                  AND id != " . $article['id'] . " 
                  AND status = 'published' 
                  ORDER BY published_at DESC 
                  LIMIT 3";
$related_articles = $conn->query($related_query);

// Set page variables
$page_title = $article['title'] . ' - ' . ($settings['site_title'] ?? 'Website Instansi');
$meta_description = $article['excerpt'] ?? substr(strip_tags($article['content']), 0, 160);

include 'includes/header.php';
?>

<!-- ============================================
   DETAIL ARTIKEL PAGE WITH PREFIX "art-"
   ============================================ -->

<style>
/* ============================================
   DETAIL ARTICLE STYLES
   Prefix: art-
   ============================================ */

.art-detail-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   BREADCRUMB
   ============================================ */

.art-breadcrumb {
    background: #f8fafc;
    padding: 16px 0;
    border-bottom: 1px solid #eef2f6;
}

.art-breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.art-breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 0.85rem;
}

.art-breadcrumb-item a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s;
}

.art-breadcrumb-item a:hover {
    color: #1d4ed8;
}

.art-breadcrumb-separator {
    color: #cbd5e1;
}

.art-breadcrumb-active {
    color: #1e293b;
    font-weight: 500;
}

/* ============================================
   ARTICLE HEADER
   ============================================ */

.art-detail-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.art-detail-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.03)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: cover;
    opacity: 0.3;
}

.art-header-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.art-category-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.9);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
    text-decoration: none;
    transition: all 0.3s;
}

.art-category-badge:hover {
    background: #3b82f6;
    transform: translateY(-2px);
}

.art-header-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 24px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.art-header-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 16px;
}

.art-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.art-meta-item i {
    font-size: 0.9rem;
    color: #3b82f6;
}

/* ============================================
   ARTICLE CONTENT
   ============================================ */

.art-detail-content {
    padding: 60px 0;
    background: #ffffff;
}

.art-content-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* Featured Image */
.art-featured-image {
    margin-bottom: 40px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}

.art-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Article Body */
.art-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #334155;
}

.art-body p {
    margin-bottom: 1.5rem;
}

.art-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    color: #1e293b;
}

.art-body h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 1.75rem 0 1rem;
    color: #1e293b;
}

.art-body img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    margin: 1.5rem 0;
}

.art-body ul, 
.art-body ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.art-body li {
    margin-bottom: 0.5rem;
}

.art-body blockquote {
    border-left: 4px solid #3b82f6;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: #f8fafc;
    border-radius: 0 16px 16px 0;
    font-style: italic;
    color: #475569;
}

/* Author Box */
.art-author-box {
    background: #f8fafc;
    border-radius: 20px;
    padding: 24px;
    margin: 40px 0;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.art-author-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}

.art-author-info {
    flex: 1;
}

.art-author-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.art-author-role {
    font-size: 0.8rem;
    color: #3b82f6;
    margin-bottom: 8px;
}

.art-author-bio {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
}

/* Share Buttons */
.art-share-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin: 40px 0;
}

.art-share-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
}

.art-share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.art-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    border-radius: 40px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.art-share-btn:hover {
    transform: translateY(-3px);
    color: white;
}

.art-share-facebook { background: #1877f2; }
.art-share-twitter { background: #1da1f2; }
.art-share-whatsapp { background: #25d366; }

/* ============================================
   RELATED ARTICLES
   ============================================ */

.art-related-section {
    background: #f8fafc;
    padding: 60px 0;
}

.art-related-header {
    text-align: center;
    margin-bottom: 40px;
}

.art-related-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.art-related-underline {
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    margin: 0 auto;
    border-radius: 3px;
}

.art-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.art-related-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #eef2f6;
}

.art-related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.1);
}

.art-related-image {
    height: 180px;
    overflow: hidden;
}

.art-related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.art-related-card:hover .art-related-image img {
    transform: scale(1.05);
}

.art-related-content {
    padding: 20px;
}

.art-related-date {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.art-related-title-link {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 12px 0;
}

.art-related-title-link a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.3s;
}

.art-related-title-link a:hover {
    color: #3b82f6;
}

.art-related-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3b82f6;
    text-decoration: none;
}

.art-related-link:hover {
    gap: 10px;
}

/* ============================================
   NAVIGATION (PREV/NEXT)
   ============================================ */

.art-nav-links {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid #eef2f6;
}

.art-nav-prev,
.art-nav-next {
    flex: 1;
    text-decoration: none;
    transition: all 0.3s;
}

.art-nav-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 4px;
    display: block;
}

.art-nav-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.art-nav-prev:hover .art-nav-title,
.art-nav-next:hover .art-nav-title {
    color: #3b82f6;
    gap: 12px;
}

.art-nav-next {
    text-align: right;
}

.art-nav-next .art-nav-title {
    justify-content: flex-end;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 992px) {
    .art-related-grid {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .art-detail-header {
        padding: 40px 0;
    }
    
    .art-header-title {
        font-size: 1.75rem;
    }
    
    .art-header-meta {
        gap: 16px;
    }
    
    .art-meta-item {
        font-size: 0.75rem;
    }
    
    .art-content-wrapper {
        padding: 0 20px;
    }
    
    .art-body {
        font-size: 0.95rem;
    }
    
    .art-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .art-nav-links {
        flex-direction: column;
    }
    
    .art-nav-prev,
    .art-nav-next {
        text-align: center;
    }
    
    .art-nav-next .art-nav-title {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .art-related-grid {
        grid-template-columns: 1fr;
    }
    
    .art-share-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .art-share-btn {
        width: 100%;
        justify-content: center;
    }
    
    .art-author-box {
        text-align: center;
        justify-content: center;
    }
}
</style>

<!-- ============================================
   BREADCRUMB
   ============================================ -->
<div class="art-breadcrumb">
    <div class="art-detail-container">
        <ul class="art-breadcrumb-nav">
            <li class="art-breadcrumb-item">
                <a href="index.php"><i class="fas fa-home"></i> Home</a>
            </li>
            <li class="art-breadcrumb-separator"><i class="fas fa-chevron-right"></i></li>
            <li class="art-breadcrumb-item">
                <a href="berita.php">Berita</a>
            </li>
            <li class="art-breadcrumb-separator"><i class="fas fa-chevron-right"></i></li>
            <li class="art-breadcrumb-item art-breadcrumb-active">
                <?php echo htmlspecialchars(substr($article['title'], 0, 50)) . (strlen($article['title']) > 50 ? '...' : ''); ?>
            </li>
        </ul>
    </div>
</div>

<!-- ============================================
   ARTICLE HEADER
   ============================================ -->
<header class="art-detail-header">
    <div class="art-detail-container">
        <div class="art-header-content">
            <a href="berita.php?category=<?php echo $article['category_slug']; ?>" class="art-category-badge">
                <i class="fas fa-folder me-1"></i> <?php echo htmlspecialchars($article['category_name']); ?>
            </a>
            <h1 class="art-header-title"><?php echo htmlspecialchars($article['title']); ?></h1>
            <div class="art-header-meta">
                <div class="art-meta-item">
                    <i class="far fa-calendar-alt"></i>
                    <span><?php echo tgl_indonesia($article['published_at'] ?: $article['created_at']); ?></span>
                </div>
                <div class="art-meta-item">
                    <i class="far fa-user"></i>
                    <span><?php echo htmlspecialchars($article['author_name']); ?></span>
                </div>
                <div class="art-meta-item">
                    <i class="far fa-eye"></i>
                    <span><?php echo number_format($article['views'] + 1); ?> views</span>
                </div>
                <div class="art-meta-item">
                    <i class="far fa-clock"></i>
                    <span><?php echo ceil(str_word_count(strip_tags($article['content'])) / 200); ?> min read</span>
                </div>
            </div>
        </div>
    </div>
</header>

<!-- ============================================
   ARTICLE CONTENT
   ============================================ -->
<section class="art-detail-content">
    <div class="art-detail-container">
        <div class="art-content-wrapper">
            
            <?php if(!empty($article['featured_image'])): ?>
            <div class="art-featured-image">
                <img src="<?php echo $article['featured_image']; ?>" alt="<?php echo htmlspecialchars($article['title']); ?>">
            </div>
            <?php endif; ?>
            
            <div class="art-body">
                <?php echo $article['content']; ?>
            </div>
            
            <!-- Author Box -->
            <div class="art-author-box">
                <?php if(!empty($article['author_avatar'])): ?>
                    <img src="<?php echo $article['author_avatar']; ?>" alt="<?php echo htmlspecialchars($article['author_name']); ?>" class="art-author-avatar">
                <?php else: ?>
                    <div class="art-author-avatar" style="display: flex; align-items: center; justify-content: center; background: #3b82f6; color: white; font-size: 1.5rem; font-weight: bold;">
                        <?php echo substr($article['author_name'], 0, 1); ?>
                    </div>
                <?php endif; ?>
                <div class="art-author-info">
                    <div class="art-author-name"><?php echo htmlspecialchars($article['author_name']); ?></div>
                    <div class="art-author-role">Penulis Artikel</div>
                    <div class="art-author-bio">Menulis artikel dan berita terbaru seputar kegiatan instansi.</div>
                </div>
            </div>
            
            <!-- Share Buttons -->
            <div class="art-share-section">
                <div class="art-share-title">
                    <i class="fas fa-share-alt me-2"></i> Bagikan Artikel Ini
                </div>
                <div class="art-share-buttons">
                    <?php 
                    $share_url = urlencode((isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
                    $share_title = urlencode($article['title']);
                    ?>
                    <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $share_url; ?>" target="_blank" class="art-share-btn art-share-facebook">
                        <i class="fab fa-facebook-f"></i> Facebook
                    </a>
                    <a href="https://twitter.com/intent/tweet?url=<?php echo $share_url; ?>&text=<?php echo $share_title; ?>" target="_blank" class="art-share-btn art-share-twitter">
                        <i class="fab fa-twitter"></i> Twitter
                    </a>
                    <a href="https://wa.me/?text=<?php echo $share_title . '%20' . $share_url; ?>" target="_blank" class="art-share-btn art-share-whatsapp">
                        <i class="fab fa-whatsapp"></i> WhatsApp
                    </a>
                </div>
            </div>
            
        </div>
    </div>
</section>

<!-- ============================================
   RELATED ARTICLES
   ============================================ -->
<?php if($related_articles && $related_articles->num_rows > 0): ?>
<section class="art-related-section">
    <div class="art-detail-container">
        <div class="art-related-header">
            <h2 class="art-related-title">Artikel Terkait</h2>
            <div class="art-related-underline"></div>
        </div>
        <div class="art-related-grid">
            <?php while($related = $related_articles->fetch_assoc()): 
                $related_url = !empty($related['url_hash']) ? 'detail-artikel.php?hash=' . $related['url_hash'] : 'detail-artikel.php?id=' . $related['id'];
            ?>
            <div class="art-related-card">
                <div class="art-related-image">
                    <?php if(!empty($related['featured_image'])): ?>
                        <img src="<?php echo $related['featured_image']; ?>" alt="<?php echo htmlspecialchars($related['title']); ?>">
                    <?php else: ?>
                        <img src="assets/images/news-default.png" alt="Default Image">
                    <?php endif; ?>
                </div>
                <div class="art-related-content">
                    <div class="art-related-date">
                        <i class="far fa-calendar-alt"></i> <?php echo tgl_indonesia($related['published_at']); ?>
                    </div>
                    <h3 class="art-related-title-link">
                        <a href="<?php echo $related_url; ?>"><?php echo htmlspecialchars($related['title']); ?></a>
                    </h3>
                    <a href="<?php echo $related_url; ?>" class="art-related-link">
                        Baca Selengkapnya <i class="fas fa-arrow-right"></i>
                    </a>
                </div>
            </div>
            <?php endwhile; ?>
        </div>
    </div>
</section>
<?php endif; ?>

<!-- Navigation Back to Berita -->
<div class="art-detail-container" style="padding: 40px 20px;">
    <div style="text-align: center;">
        <a href="berita.php" class="art-share-btn" style="background: #e2e8f0; color: #1e293b; display: inline-flex;">
            <i class="fas fa-arrow-left me-2"></i> Kembali ke Daftar Berita
        </a>
    </div>
</div>

<?php include 'includes/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit