:: **Zploit** v1.0 | Current Path: **/home/iictguj2/indiadealfinder.com/public_html/**
:: Editing File: deal.php
<?php include('includes/db.php'); include('header.php'); if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { echo "<div class='container'><p>Invalid deal ID.</p></div>"; include('footer.php'); exit; } $deal_id = intval($_GET['id']); $stmt = $conn->prepare("SELECT deals.*, categories.name AS category FROM deals LEFT JOIN categories ON deals.category_id = categories.id WHERE deals.id = ? AND deals.is_active = 1"); $stmt->bind_param("i", $deal_id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { echo "<div class='container'><p>Deal not found or inactive.</p></div>"; include('footer.php'); exit; } $deal = $result->fetch_assoc(); // Decode HTML entities $deal_title = html_entity_decode($deal['title']); $deal_description = html_entity_decode($deal['description']); // Expiry countdown $expires = strtotime($deal['expires_at']); $now = time(); $diff = $expires - $now; if ($diff > 0) { $days = floor($diff / (60 * 60 * 24)); $hours = floor(($diff % (60 * 60 * 24)) / 3600); $mins = floor(($diff % 3600) / 60); $expire_str = "{$days}d {$hours}h {$mins}m left"; } else { $expire_str = "<span style='color:red;'>Expired</span>"; } // Image URL handling $image = ''; if (!empty($deal['image'])) { if (strpos($deal['image'], 'http://') === 0 || strpos($deal['image'], 'https://') === 0) { $image = htmlspecialchars($deal['image']); } else { $image = 'uploads/' . htmlspecialchars($deal['image']); } } else { $image = 'placeholder.jpg'; // Fallback image } ?> <style> .deal-detail { max-width: 800px; margin: 30px auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); font-family: Arial, sans-serif; } .deal-detail img { width: 100%; height: auto; max-height: 400px; object-fit: contain; margin-bottom: 15px; border-radius: 6px; } .deal-detail h1 { font-size: 28px; margin-bottom: 10px; } .deal-detail p { font-size: 16px; line-height: 1.6; } .deal-meta { font-size: 14px; color: #666; margin-bottom: 10px; } .grab-btn { display: inline-block; margin-top: 15px; padding: 12px 20px; background: #007bff; color: #fff; text-decoration: none; font-weight: bold; border-radius: 5px; } .grab-btn:hover { background: #0056b3; } .like-btn { background: none; border: none; color: #007bff; cursor: pointer; font-size: 16px; padding: 0; margin-top: 10px; } .like-btn:hover { text-decoration: underline; } </style> <div class="deal-detail"> <img src="<?= $image ?>" alt="<?= htmlspecialchars($deal_title) ?>"> <h1><?= htmlspecialchars($deal_title) ?></h1> <div class="deal-meta"> <strong>Category:</strong> <?= htmlspecialchars($deal['category']) ?><br> <strong>Expires:</strong> <?= $expire_str ?><br> <strong>Likes:</strong> <span id="like-count-<?= $deal['id'] ?>"><?= $deal['likes'] ?></span> </div> <p><?= nl2br(htmlspecialchars($deal_description)) ?></p> <?php $affiliate_url = trim($deal['affiliate_url']); $prefix = 'https://dealofthedayindia.com/go.php?'; if (strpos($affiliate_url, $prefix) === 0) { $affiliate_url = substr($affiliate_url, strlen($prefix)); } ?> <a href="<?= htmlspecialchars($affiliate_url) ?>" class="grab-btn" target="_blank" rel="nofollow noopener">Grab This Deal</a> <br> <button class="like-btn" data-id="<?= $deal['id'] ?>">👍 Like</button> </div> <script> document.querySelector('.like-btn').addEventListener('click', function () { const dealId = this.getAttribute('data-id'); fetch('like.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'deal_id=' + dealId }) .then(response => response.text()) .then(data => { document.getElementById('like-count-' + dealId).textContent = data; }); }); </script> <?php include('footer.php'); ?>