One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
84.32.84.222
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
awaha.in
/
public_html
/
Edit File:
new
<?php session_start(); include 'admin/connection.inc.php'; if (!$conn) { die("Database connection failed"); } $wishlist_items = []; if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $stmt = $conn->prepare(" SELECT w.product_id, p.product_name, p.product_price, p.product_img FROM wishlist w JOIN products p ON w.product_id = p.id WHERE w.user_id = ? ORDER BY w.product_id DESC "); $stmt->bind_param('i', $user_id); $stmt->execute(); $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { $wishlist_items[] = $row; } $stmt->close(); } else { $wishlist = isset($_COOKIE['wishlist']) ? json_decode($_COOKIE['wishlist'], true) : []; foreach ($wishlist as $product_id) { $stmt = $conn->prepare("SELECT id as product_id, product_name, product_price, product_img FROM products WHERE id = ?"); $stmt->bind_param('i', $product_id); $stmt->execute(); $result = $stmt->get_result(); if ($row = $result->fetch_assoc()) { $wishlist_items[] = $row; } $stmt->close(); } } $conn->close(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Wishlist</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <style> .wishlist-container { max-width: 900px; margin: 50px auto; } .wishlist-item { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid #ddd; background: #fff; border-radius: 10px; margin-bottom: 15px; } .wishlist-item img { width: 100px; height: 100px; object-fit: cover; border-radius: 10px; } .wishlist-item-details { flex: 1; margin-left: 15px; } .wishlist-item h5 { margin: 0; font-size: 18px; } .wishlist-item p { margin: 5px 0; color: #777; } .remove-btn { background: red; color: white; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; } </style> </head> <body> <div class="container wishlist-container"> <h2 class="text-center">Your Wishlist</h2> <?php if (!empty($wishlist_items)) { ?> <?php foreach ($wishlist_items as $item) { ?> <div class="wishlist-item"> <img src="images/<?php echo $item['product_img']; ?>" alt="<?php echo $item['product_name']; ?>"> <div class="wishlist-item-details"> <h5><?php echo $item['product_name']; ?></h5> <p>Price: ₹<?php echo number_format($item['product_price'], 2); ?></p> </div> <button class="remove-btn" onclick="removeFromWishlist(<?php echo $item['product_id']; ?>)">Remove</button> </div> <?php } ?> <?php } else { ?> <p class="text-center">Your wishlist is empty.</p> <?php } ?> </div> <script> function removeFromWishlist(productId) { fetch('remove_wishlist.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'product_id=' + productId }) .then(response => response.json()) .then(data => { if (data.success) { location.reload(); // Refresh the page after removal } else { alert(data.message); } }); } </script> </body> </html>
Simpan