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 :  D:/bpkd_/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/bpkd_/repost.php
<?php
// repost.php
require_once 'includes/init.php';
require_once 'includes/header.php';
require_once 'includes/tokenkab.php';

$urlHash = $_GET['hash'] ?? '';
if (empty($urlHash)) { http_response_code(404); include 'error/404.php'; exit; }

$urlHashEsc = $conn->real_escape_string($urlHash);
$q = $conn->query("SELECT * FROM repost_berita WHERE url_hash = '$urlHashEsc' LIMIT 1");
if (!$q || $q->num_rows === 0) { http_response_code(404); include 'error/404.php'; exit; }

$repost = $q->fetch_assoc();
$page_title = $repost['judul'];

// Fetch isi live dari sumber asli
$isiLive = null;
$cacheKey = 'repost_isi_' . $urlHash;

// Cek cache session (1 jam)
if (isset($_SESSION[$cacheKey]) && (time() - $_SESSION[$cacheKey]['time']) < 3600) {
    $isiLive = $_SESSION[$cacheKey]['content'];
} else {
    // Fetch live
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => $repost['link_asli'],
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 15,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
    ]);
    $html = curl_exec($ch);
    curl_close($ch);
    
    if ($html) {
        // Ambil isi dari tag <div class="..."> utama
        // Sesuaikan pattern dengan struktur HTML portalberita
        if (preg_match('/<div[^>]*class="[^"]*detail[^"]*"[^>]*>(.*?)<\/div>/is', $html, $m)) {
            $isiLive = $m[1];
        } elseif (preg_match('/<article[^>]*>(.*?)<\/article>/is', $html, $m)) {
            $isiLive = $m[1];
        }
        
        // Simpan ke cache
        if ($isiLive) {
            $_SESSION[$cacheKey] = ['content' => $isiLive, 'time' => time()];
        }
    }
}

// ============================================================
// FETCH ISI LIVE DARI SUMBER ASLI
// ============================================================
function fetchContentFromSource($url) {
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 15,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
    ]);
    $html = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    if ($httpCode !== 200 || empty($html)) return null;
    
    // Coba ambil konten utama dari struktur portalberita
    $content = '';
    
    // Coba selector umum
    $patterns = [
        '/<div[^>]*class="[^"]*content[^"]*"[^>]*>(.*?)<\/div>/is',
        '/<div[^>]*class="[^"]*detail[^"]*"[^>]*>(.*?)<\/div>/is',
        '/<article[^>]*>(.*?)<\/article>/is',
        '/<div[^>]*id="[^"]*content[^"]*"[^>]*>(.*?)<\/div>/is',
    ];
    
    foreach ($patterns as $pattern) {
        if (preg_match($pattern, $html, $m)) {
            $content = $m[1];
            break;
        }
    }
    
    // Fallback: ambil body, buang script/style
    if (empty($content)) {
        if (preg_match('/<body[^>]*>(.*?)<\/body>/is', $html, $m)) {
            $content = $m[1];
            $content = preg_replace('/<script\b[^>]*>.*?<\/script>/is', '', $content);
            $content = preg_replace('/<style\b[^>]*>.*?<\/style>/is', '', $content);
            $content = preg_replace('/<nav\b[^>]*>.*?<\/nav>/is', '', $content);
            $content = preg_replace('/<header\b[^>]*>.*?<\/header>/is', '', $content);
            $content = preg_replace('/<footer\b[^>]*>.*?<\/footer>/is', '', $content);
        }
    }
    
    return trim($content);
}

// Coba ambil dari cache session dulu (biar tidak fetch 2x)
$cacheKey = 'repost_content_' . $urlHash;
$content = null;

if (isset($_SESSION[$cacheKey]) && (time() - $_SESSION[$cacheKey]['time']) < 3600) {
    // Cache 1 jam
    $content = $_SESSION[$cacheKey]['content'];
} else {
    $content = fetchContentFromSource($repost['link_asli']);
    if ($content) {
        $_SESSION[$cacheKey] = ['content' => $content, 'time' => time()];
    }
}
?>

<style>
.repost-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.repost-header {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.repost-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.repost-title {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1a2c3e;
    margin-bottom: 16px;
}

.repost-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: #64748b;
    font-size: 0.85rem;
}

.repost-source-info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.repost-source-info .label {
    font-size: 0.75rem;
    color: #1d4ed8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.repost-source-info .url {
    color: #1e293b;
    font-size: 0.85rem;
    word-break: break-all;
}

.repost-source-info .btn-source {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    margin-top: 12px;
    transition: background 0.3s;
}

.repost-source-info .btn-source:hover {
    background: #1d4ed8;
}

.repost-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    line-height: 1.8;
    color: #334155;
}

.repost-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 16px 0;
}

.repost-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    color: #475569;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #e2e8f0;
    color: #1e293b;
}

@media (max-width: 768px) {
    .repost-title { font-size: 1.4rem; }
    .repost-content { padding: 24px; }
    .repost-header { padding: 20px; }
}
</style>

<div class="container py-5">
    <div class="row">
        <div class="col-lg-8 mx-auto">
            
            <!-- BADGE REPOST -->
            <div class="mb-3">
                <span class="badge bg-warning text-dark px-3 py-2">
                    <i class="fas fa-share-alt me-1"></i>Repost dari Portal Berita Lumajang
                </span>
            </div>
            
            <!-- JUDUL -->
            <h1 class="h3 fw-bold mb-3"><?php echo htmlspecialchars($repost['judul']); ?></h1>
            
            <!-- META -->
            <div class="text-muted small mb-4">
                <i class="far fa-calendar me-1"></i>
                <?php echo date('d F Y', strtotime($repost['tanggal_berita'] ?? $repost['created_at'])); ?>
            </div>
            
            <!-- FOTO -->
            <?php if (!empty($repost['foto'])): ?>
            <div class="mb-4">
                <img src="<?php echo htmlspecialchars($repost['foto']); ?>" 
                     alt="<?php echo htmlspecialchars($repost['judul']); ?>" 
                     class="img-fluid rounded w-100"
                     style="max-height: 500px; object-fit: cover;">
            </div>
            <?php endif; ?>
            
            <!-- SUMBER ASLI -->
            <div class="alert alert-info mb-4">
                <div class="small text-uppercase fw-bold text-primary mb-1">
                    <i class="fas fa-link me-1"></i>Sumber Asli
                </div>
                <div class="small mb-2" style="word-break: break-all;">
                    <?php echo htmlspecialchars($repost['link_asli']); ?>
                </div>
                <a href="<?php echo htmlspecialchars($repost['link_asli']); ?>" 
                   target="_blank" rel="noopener" class="btn btn-sm btn-primary">
                    <i class="fas fa-external-link-alt me-1"></i>Baca di Sumber Asli
                </a>
            </div>
            
            <!-- ============================================================ -->
            <!-- ISI — INI DIA TEMPATNYA -->
            <!-- ============================================================ -->
            <div class="content-body mb-4">
                <?php if (!empty($isiLive)): ?>
                    <?php echo $isiLive; ?>
                <?php elseif (!empty($repost['cuplik'])): ?>
                    <p><?php echo nl2br(htmlspecialchars($repost['cuplik'])); ?></p>
                    <div class="alert alert-secondary mt-3">
                        <i class="fas fa-info-circle me-1"></i>
                        Ini hanya cuplikan. 
                        <a href="<?php echo htmlspecialchars($repost['link_asli']); ?>" target="_blank">
                            Baca selengkapnya di sumber asli
                        </a>.
                    </div>
                <?php else: ?>
                    <div class="alert alert-warning">
                        ⚠️ Konten tidak tersedia.
                    </div>
                <?php endif; ?>
            </div>
            <!-- ============================================================ -->
            
            <!-- TOMBOL KEMBALI -->
            <div class="text-center mt-5">
                <a href="index.php" class="btn btn-outline-secondary">
                    <i class="fas fa-arrow-left me-1"></i>Kembali
                </a>
            </div>
            
        </div>
    </div>
</div>

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

Youez - 2016 - github.com/yon3zu
LinuXploit