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-add-blog.php
<?php session_start(); include 'header.php'; include 'sidebar.php'; include "../connection.php"; ?> <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">Add Blog</h3> <ul class="breadcrumb"> <li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li> / <li class="breadcrumb-item active">Add 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> <?php if(isset($_POST['submit'])) { $blog_name = $_POST['blog_name']; $description = $_POST['description']; $category = $_POST['category']; // Array to store uploaded file names $uploaded_files = array(); // Check if files were uploaded if(!empty(array_filter($_FILES['img']['name']))) { $total_files = count($_FILES['img']['name']); // Loop through each set of five images for($i = 0; $i < $total_files; $i += 5) { $event_images = array_slice($_FILES['img']['name'], $i, 5); // Prepare a separate blog entry for each set of five images $sql = "INSERT INTO `blog`(`blog_name`, `description`, `img`, `category`) VALUES (?,?,?,?)"; $stmt = $conn->prepare($sql); foreach($event_images as $img) { $tmp_name = $_FILES['img']['tmp_name'][$i]; $target = "../uploads/" . basename($img); // Attempt to move uploaded file to destination if(move_uploaded_file($tmp_name, $target)) { $uploaded_files[] = $img; } } // Insert into database $stmt->execute([$blog_name, $description, implode(',', $uploaded_files), $category]); // Clear array for next set of images $uploaded_files = array(); } } // Redirect with success message header("Location: all-blog.php?msg=success"); exit; } ?> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="card-body"> <form action="" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-12"> <h5 class="form-title"><span>Blog Details</span></h5> </div> <div class="col-12 col-sm-4"> <div class="form-group"> <label>Blog Name</label> <input type="text" name="blog_name" class="form-control" required> </div> </div> <div class="col-12 col-sm-4"> <div class="form-group"> <label>Category</label> <input type="text" name="category" class="form-control"> </div> </div> <div class="col-12 col-sm-12"> <div class="form-group"> <label>Blog Images (up to 5)</label> <input type="file" name="img[]" class="form-control" multiple accept="image/*"> </div> </div> <div class="col-12 col-sm-12"> <div class="form-group"> <label>Description</label> <textarea class="form-control" name="description" id="editor1" required></textarea> </div> </div> <div class="col-12"> <button type="submit" name="submit" class="btn btn-primary">Submit</button> </div> </div> </form> </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