:: **Zploit** v1.0 | Current Path: **/home/iictguj2/iictindia.in/public/assets/**

Search Results

$maxWords) { $words = array_slice($words, 0, $maxWords); $truncated = implode(' ', $words); if (strlen($truncated) > $maxChars) { $truncated = mb_substr($truncated, 0, $maxChars); $truncated = rtrim($truncated); } return htmlspecialchars($truncated) . '...'; } else { if (strlen($text) > $maxChars) { $truncated = mb_substr($text, 0, $maxChars); $truncated = rtrim($truncated); return htmlspecialchars($truncated) . '...'; } else { return htmlspecialchars($text); } } } // Pagination setup $limit = 20; $page = isset($_GET['page']) && is_numeric($_GET['page']) ? intval($_GET['page']) : 1; $offset = ($page - 1) * $limit; if (isset($_GET['q'])) { $q = $conn->real_escape_string($_GET['q']); // Count total search results $countRes = $conn->query("SELECT COUNT(*) AS total FROM deals WHERE (title LIKE '%$q%' OR description LIKE '%$q%') AND is_active = 1"); $totalDeals = $countRes->fetch_assoc()['total']; $totalPages = ceil($totalDeals / $limit); // SQL query for search results $sql = "SELECT deals.*, categories.name AS category FROM deals LEFT JOIN categories ON deals.category_id = categories.id WHERE (deals.title LIKE '%$q%' OR deals.description LIKE '%$q%') AND is_active = 1 ORDER BY created_at DESC LIMIT $limit OFFSET $offset"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo '
'; while ($row = $result->fetch_assoc()) { // Deal expiry logic if (empty($row['expires_at'])) { $created_at = strtotime($row['created_at']); $now = time(); $diff = $now - $created_at; $expire_str = ($diff > (7 * 24 * 60 * 60)) ? "Expired" : "Soon"; } else { $expires = strtotime($row['expires_at']); $now = time(); $diff = $expires - $now; $expire_str = $diff > 0 ? floor($diff / (60 * 60 * 24)) . "d " . floor(($diff % (60 * 60 * 24)) / 3600) . "h " . floor(($diff % 3600) / 60) . "m left" : "Expired"; } // Image handling $image = !empty($row['image']) ? (strpos($row['image'], 'http://') === 0 || strpos($row['image'], 'https://') === 0 ? $row['image'] : 'uploads/' . $row['image']) : 'placeholder.jpg'; // Affiliate URL $affiliate_url = $row['affiliate_url'] ?? ''; $prefix = 'https://dealofthedayindia.com/go.php?'; if (strpos($affiliate_url, $prefix) === 0) { $affiliate_url = substr($affiliate_url, strlen($prefix)); } // Output deal card echo "
"; echo "" . htmlspecialchars($row["; echo "

" . truncateTitle($row['title']) . "

"; echo "
" . substr(strip_tags($row['description']), 0, 150) . "...
"; echo "
Category: " .