📁
SKYSHELL MANAGER
PHP v8.1.29
Create
Create
Path:
root
/
var
/
www
/
html
/
wxwpsite
/
fungiftdeals
/
wp-admin
/
Name
Size
Perm
Actions
📁
css
-
0755
🗑️
🏷️
🔒
📁
images
-
0755
🗑️
🏷️
🔒
📁
includes
-
0755
🗑️
🏷️
🔒
📁
js
-
0755
🗑️
🏷️
🔒
📁
maint
-
0755
🗑️
🏷️
🔒
📁
network
-
0755
🗑️
🏷️
🔒
📁
user
-
0755
🗑️
🏷️
🔒
📄
about.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
admin-footer.php
2.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
admin-functions.php
0.47 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
admin.php
12.63 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
async-upload.php
5.47 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
authorize-application.php
10.09 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
comment.php
11.37 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
custom-header.php
0.49 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
customize.php
11.21 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
edit-form-blocks.php
14.73 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
edit.php
19.48 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
export-personal-data.php
7.75 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
font-library.php
1.01 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
home.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
📄
index.php
7.68 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
media-upload.php
3.58 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
menu-header.php
9.82 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
network.php
5.39 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
press-this.php
2.41 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
privacy.php
2.83 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
setup-config.php
17.52 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
themes.phpwp-update.php
114.83 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
update.php
12.76 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
user-edit.php
40.35 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
widgets-form-blocks.php
5.12 KB
0644
🗑️
🏷️
⬇️
✏️
🔒
📄
wp-mail.php
6.83 KB
0444
🗑️
🏷️
⬇️
✏️
🔒
Edit: update_post.php
<?php // Set session timeout and inactivity handling ini_set('session.gc_maxlifetime', 3600); session_set_cookie_params(3600); // Start the session session_start(); // Inactivity timeout $inactivityTimeout = 9000; // 150 minutes if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity']) > $inactivityTimeout) { session_unset(); session_destroy(); header("Location: login.php"); exit(); } $_SESSION['last_activity'] = time(); // Check if the user is logged in if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { header("Location: login.php"); exit(); } ?> <?php // Database connection require 'db_connection.php'; // Initialize variables $id = null; $post = []; // Check if the `id` parameter is passed if (isset($_GET['id'])) { $id = intval($_GET['id']); // Fetch the post details $sql = "SELECT * FROM post WHERE id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 1) { $post = $result->fetch_assoc(); } else { echo "Post not found."; exit(); } } else { echo "Invalid request."; exit(); } // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $title = $_POST['title']; $category = $_POST['category']; $description = $_POST['description']; $content = $_POST['content']; $author = $_POST['author']; // Define upload directory $uploadDir = "uploads/"; // Ensure the uploads folder exists if (!is_dir($uploadDir)) { mkdir($uploadDir, 0777, true); } // Process product image $pst_img = $post['pst_img']; if (!empty($_FILES['image']['name'])) { $imageName = time() . "_" . basename($_FILES['image']['name']); $pst_img = $uploadDir . $imageName; move_uploaded_file($_FILES['image']['tmp_name'], $pst_img); } // Update the post details in the database $sql = "UPDATE post SET title = ?, category = ?, description = ?, content = ?, author = ?, pst_img = ? WHERE id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("ssssssi", $title, $category, $description, $content, $author, $pst_img, $id); if ($stmt->execute()) { header("Location: dashboard.php"); // Redirect to the dashboard after updating exit(); } else { echo "Error updating post: " . $conn->error; } } $conn->close(); ?> <!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags--> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Title Page--> <title>Admin</title> <link rel="icon" href="css/fav.ico" type="css/fav.ico"> <!-- Icons font CSS--> <link href="vendorfile/mdi-font/css/material-design-iconic-font.min.css" rel="stylesheet" media="all"> <link href="vendorfile/font-awesome-4.7/css/font-awesome.min.css" rel="stylesheet" media="all"> <!-- Font special for pages--> <link href="https://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet"> <!-- Vendor CSS--> <link href="vendorfile/select2/select2.min.css" rel="stylesheet" media="all"> <link href="vendorfile/datepicker/daterangepicker.css" rel="stylesheet" media="all"> <!-- Main CSS--> <link href="dashcss/main.css" rel="stylesheet" media="all"> </head> <body> <div class="page-wrapper bg-gra-02 p-t-130 p-b-100 font-poppins"> <div class="wrapper wrapper--w680"> <div class="card card-4"> <div class="card-body"> <div class="row row-space"> <div class="col-3"> <h2 class="title" style="text-align:left;">Update Post</h2> </div> <div class="col-3"> <div style="text-align: right;"> <a href="dashboard.php"> <button type="button" class="btn btn--radius-2 btn--lblue">Dashboard</button> </a> </div> </div> <div class="col-3"> <div style="text-align: right;"> <a href="logout.php"> <button type="submit" class="btn btn--radius-2 btn--red">Logout</button> </a> </div> </div> </div> <form action="" method="POST" enctype="multipart/form-data"> <div class="input-group"> <label class="label">Title *</label> <input class="input--style-4" type="text" id="title" name="title" value="<?php echo htmlspecialchars($post['title']); ?>"> </div> <div class="input-group"> <label class="label">Category *</label> <div class="rs-select2 js-select-simple select--no-search"> <select id="category" name="category"> <option value="<?php echo htmlspecialchars($post['category']); ?>"><?php echo htmlspecialchars($post['category']); ?></option> <option value="Top News">Top News</option> <option value="Trending News">Trending News</option> <option value="World News">World News</option> <option value="Finance News">Finance News</option> <option value="Market News">Market News</option> <option value="Technology News">Technology News</option> <option value="Latest News">Latest News</option> </select> <div class="select-dropdown"></div> </div> </div> <div class="input-group"> <label class="label">Description *</label> <textarea class="input--style-4" id="description" name="description" style="height: 200px;width:100%;line-height: normal;"><?php echo htmlspecialchars($post['description']); ?></textarea> </div> <div class="input-group"> <label class="label">Content * Html Formate</label> <textarea class="input--style-4" id="content" name="content" style="height: 200px;width:100%;line-height: normal;"><?php echo htmlspecialchars($post['content']); ?></textarea> </div> <div class="input-group"> <label class="label">Post Image * size : 1200*675</label> <input class="input--style-4" type="file" id="image" name="image" accept="image/*"><br><br> </div> <div class="input-group"> <label class="label">Author Name & Team*</label> <input class="input--style-4" type="text" id="author" name="author" value="<?php echo htmlspecialchars($post['author']); ?>"><br><br> </div> <div class="row row-space"> <div class="col-2"> <div class="input-group"> <input type="submit" class="btn btn--radius-2 btn--blue" value="Update Post" style="width:auto;"> </div> </div> </div> </div> </form> <br> </div> </div> </div> </div> <script> if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } </script> <!-- Jquery JS--> <script src="vendorfile/jquery/jquery.min.js"></script> <!-- Vendor JS--> <script src="vendorfile/select2/select2.min.js"></script> <script src="vendorfile/datepicker/moment.min.js"></script> <script src="vendorfile/datepicker/daterangepicker.js"></script> <!-- Main JS--> <script src="dashjs/global.js"></script> </body> </html> <!-- end document-->
Save