BLACKSITE
:
216.73.216.62
:
147.93.18.13 / vinyasaweddings.com
:
Linux srv667811 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
:
/
var
/
www
/
insonohearing
/
admin
/
Upload File:
files >> /var/www/insonohearing/admin/add_page.php
<?php require __DIR__ . '/../db.php'; // adjust path based on where add_page.php is located $allProductsStmt = $conn->query("SELECT id, name FROM products"); $allProducts = $allProductsStmt->fetchAll(PDO::FETCH_ASSOC); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $page_heading = $_POST['page_heading']; $slug = $_POST['slug']; $hero_content = $_POST['hero_content']; $about_header = $_POST['about_header']; $about_detail = $_POST['about_detail']; $product_heading = $_POST['product_heading'] ?? ''; $product_ids = !empty($_POST['product_ids']) ? implode(',', $_POST['product_ids']) : ''; // Handle about image $imagePath = ''; if (!empty($_FILES['about_image']['name'])) { $uploadDir = 'uploads/'; if (!is_dir($uploadDir)) mkdir($uploadDir); $filename = time() . '_' . basename($_FILES['about_image']['name']); $targetFile = $uploadDir . $filename; if (move_uploaded_file($_FILES['about_image']['tmp_name'], $targetFile)) { $imagePath = 'uploads/' . $filename; } } // Insert landing page $stmt = $conn->prepare("INSERT INTO landing_pages (page_heading, slug, hero_content, about_header, about_detail, about_image, product_heading, product_ids) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([ $page_heading, $slug, $hero_content, $about_header, $about_detail, $imagePath, $product_heading, $product_ids ]); $pageId = $conn->lastInsertId(); // Insert FAQs if (!empty($_POST['faq'])) { foreach ($_POST['faq'] as $faq) { $question = $faq['question']; $answer = $faq['answer']; $faqStmt = $conn->prepare("INSERT INTO faqs (landing_page_id, question, answer) VALUES (?, ?, ?)"); $faqStmt->execute([$pageId, $question, $answer]); } } // Redirect or show success message echo "<script>alert('Landing Page Created!'); window.location.href='index.php?page=dashboard';</script>"; exit; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Add Landing Page</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jodit/build/jodit.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jodit/build/jodit.min.css"> <link rel="icon" href="https://insonohearing.com/assets_b/img/favicon-32x32.png" type="image/png" sizes="32x32"> <link rel="icon" href="https://insonohearing.com/assets_b/img/favicon-32x32.png" type="image/png" sizes="16x16"> <style> .faq-item { margin-bottom: 1rem; padding: 1rem; border: 1px solid #ddd; border-radius: 8px; background: #f9f9f9; } </style> </head> <body> <div class="container mt-4 mb-5"> <h3 class="mb-4">Add New Landing Page</h3> <form method="POST" action="" enctype="multipart/form-data"> <!-- Main Info --> <div class="mb-3"> <label>Page Heading</label> <input type="text" class="form-control" name="page_heading" required> </div> <div class="mb-3"> <label>Slug (URL)</label> <input type="text" class="form-control" name="slug" required> </div> <!-- Hero Section --> <div class="mb-3"> <label>Hero Section Content</label> <textarea id="heroEditor" name="hero_content"></textarea> </div> <!-- About Section --> <hr> <h5 class="mb-3">About Section</h5> <div class="mb-3"> <label>About Header</label> <input type="text" class="form-control" name="about_header"> </div> <div class="mb-3"> <label>About Detail</label> <textarea id="aboutEditor" name="about_detail"></textarea> </div> <div class="mb-3"> <label>About Image</label> <input type="file" class="form-control" name="about_image" accept="image/*" onchange="previewImage(event)"> <img id="imagePreview" src="#" alt="Image Preview" class="img-fluid mt-2" style="display:none; max-height: 200px;"> </div> <hr> <h5 class="mb-3">Products Section</h5> <div class="mb-3"> <label>Product Heading</label> <input type="text" class="form-control" name="product_heading"> </div> <div class="mb-3"> <label>Select Products to Show</label> <select name="product_ids[]" class="form-select" multiple> <?php foreach ($allProducts as $product): ?> <option value="<?= $product['id'] ?>"><?= htmlspecialchars($product['name']) ?></option> <?php endforeach; ?> </select> <small class="text-muted">Hold Ctrl (Windows) or Cmd (Mac) to select multiple products</small> </div> <!-- FAQ Section --> <hr> <h5 class="mb-3">FAQ Section</h5> <div id="faqContainer"></div> <button type="button" class="btn btn-outline-primary mb-3" onclick="addFAQ()">+ Add FAQ</button> <!-- Submit --> <button type="submit" class="btn btn-success w-100">Save Page</button> </form> </div> <script> const heroEditor = new Jodit("#heroEditor"); const aboutEditor = new Jodit("#aboutEditor"); let faqIndex = 0; function addFAQ() { const container = document.getElementById('faqContainer'); const faqHTML = ` <div class="faq-item" id="faq-${faqIndex}"> <div class="mb-2"> <label>Question</label> <input type="text" class="form-control" name="faq[${faqIndex}][question]" required> </div> <div class="mb-2"> <label>Answer</label> <textarea class="form-control" name="faq[${faqIndex}][answer]" required></textarea> </div> <button type="button" class="btn btn-sm btn-danger" onclick="removeFAQ(${faqIndex})">Remove</button> </div> `; container.insertAdjacentHTML('beforeend', faqHTML); faqIndex++; } function removeFAQ(index) { const el = document.getElementById(`faq-${index}`); if (el) el.remove(); } function previewImage(event) { const image = document.getElementById('imagePreview'); image.src = URL.createObjectURL(event.target.files[0]); image.style.display = 'block'; } </script> </body> </html>