X7ROOT File Manager
Current Path:
/home/u742491609/domains/apca.org.in/public_html/admin
home
/
u742491609
/
domains
/
apca.org.in
/
public_html
/
admin
/
??
..
??
.htaccess
(98 B)
??
add-blog.php
(4.24 KB)
??
add-blog1.php
(3.14 KB)
??
add-blog2.php
(4.77 KB)
??
add-blog3.php
(3.71 KB)
??
all-blog.php
(5.62 KB)
??
all-blog1.php
(2.07 KB)
??
all-subscriber.php
(1.83 KB)
??
assets
??
connection.php
(675 B)
??
connectivity
??
convocation
??
dashboard.php
(1.57 KB)
??
delete-blog.php
(332 B)
??
edit-add-blog.php
(5.25 KB)
??
edit-add-blog1.php
(9.63 KB)
??
edit-blog.php
(5.12 KB)
??
error_log
(4.92 KB)
??
footer.php
(954 B)
??
header.php
(2.21 KB)
??
inaugration
??
index.php
(3.6 KB)
??
logout.php
(80 B)
??
others
??
passing-out-parade
??
republic-independence
??
short-term
??
sidebar.php
(4.43 KB)
??
track_visitors.php
(1.29 KB)
??
uploads
Editing: edit-blog.php
<?php ob_start(); session_start(); include("../connection.php"); include 'header.php'; include 'sidebar.php'; // Fetch blog ID from the URL $id = $_GET["id"]; // Fetch existing blog data from the database $stmt = $conn->prepare("SELECT * FROM blog WHERE id=?"); $stmt->execute([$id]); $blog = $stmt->fetch(); // Check if form is submitted for update if(isset($_POST['update'])){ $blog_name = $_POST['blog_name']; $description = $_POST['description']; $category = $_POST['category']; $image = $_FILES['img']['name']; $target = "../uploads/".basename($image); $file_upload = move_uploaded_file($_FILES['img']['tmp_name'], $target); // Determine if a new image was uploaded if($_FILES['img']['name'] != ''){ $sql = "UPDATE `blog` SET `blog_name`=?, `description`=?, `img`=?, `category`=? WHERE `id`=?"; $update = $conn->prepare($sql)->execute([$blog_name, $description, $image, $category, $id]); } else { $sql = "UPDATE `blog` SET `blog_name`=?, `description`=?, `category`=? WHERE `id`=?"; $update = $conn->prepare($sql)->execute([$blog_name, $description, $category, $id]); } // Check if update was successful if($update) { header("Location: all-blog.php?msg=success"); exit(); // Prevent further execution } else { header("Location: all-blog.php?msg=failed"); exit(); // Prevent further execution } } ?> <div class="page-wrapper"> <div class="content container-fluid"> <div class="page-header"> <div class="row"> <div class="col-sm-12"> <h3 class="page-title">Edit Blog</h3> <ul class="breadcrumb"> <li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li> / <li class="breadcrumb-item active">Edit Blog</li> </ul> </div> <div class="col-auto text-end float-end ms-auto"> <a href="all-blog.php" class="btn btn-outline-info me-2"><i class="fas fa-eye"></i> View</a> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <div class="container mt-5"> <h1>Gallery Admin Panel</h1> <form action="upload.php" method="POST" enctype="multipart/form-data"> <div class="form-group"> <label for="title">Title:</label> <input type="text" name="title" class="form-control" required> </div> <div class="form-group"> <label for="category">Category:</label> <input type="text" name="category" class="form-control" required> </div> <div class="form-group"> <label for="description">Description:</label> <textarea name="description" class="form-control" required></textarea> </div> <div class="form-group"> <label for="images">Images:</label> <input type="file" name="images[]" class="form-control" multiple required> </div> <button type="submit" class="btn btn-primary">Upload</button> </form> <h2 class="mt-5">Manage Sections and Images</h2> <?php foreach ($sections as $section): ?> <div class="card mt-3"> <div class="card-header"> <h3><?php echo htmlspecialchars($section['title']); ?></h3> <p><?php echo htmlspecialchars($section['category']); ?></p> <p><?php echo htmlspecialchars($section['description']); ?></p> <a href="edit_section.php?id=<?php echo $section['id']; ?>" class="btn btn-warning">Edit</a> <a href="delete_section.php?id=<?php echo $section['id']; ?>" class="btn btn-danger">Delete</a> </div> <div class="card-body"> <?php $stmt = $pdo->prepare("SELECT * FROM images WHERE section_id = :section_id"); $stmt->execute(['section_id' => $section['id']]); $images = $stmt->fetchAll(PDO::FETCH_ASSOC); ?> <?php foreach ($images as $image): ?> <div class="img-thumbnail d-inline-block mr-2"> <img src="<?php echo htmlspecialchars($image['image_path']); ?>" alt="Image" class="img-fluid"> <a href="edit_image.php?id=<?php echo $image['id']; ?>" class="btn btn-warning btn-sm mt-2">Edit</a> <a href="delete_image.php?id=<?php echo $image['id']; ?>" class="btn btn-danger btn-sm mt-2">Delete</a> </div> <?php endforeach; ?> </div> </div> <?php endforeach; ?> </div> </div> </div> </div> </div> </div> </div> <script src="https://cdn.ckeditor.com/4.19.1/standard/ckeditor.js"></script> <script> CKEDITOR.replace('editor1'); </script> <?php include 'footer.php'; ?>
Upload File
Create Folder