D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
delete_mp4.php
back
Copy
<?php include "../config.php"; ?> <?php if (isset($_GET['mp4_id'])) { $mp4_id = $_GET['mp4_id']; $sql = "SELECT mp4_name FROM mp4 WHERE mp4_id = $mp4_id"; $result = $conn->query($sql); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $mp4File = $row['mp4_name']; // Delete the file from the uploads directory $filePath = "uploads/mp4/" . $mp4File; if (file_exists($filePath)) { unlink($filePath); // Delete the file } // Delete record from the database $deleteSQL = "DELETE FROM mp4 WHERE mp4_id = $mp4_id"; if ($conn->query($deleteSQL) === TRUE) { echo "MP4 file " . $mp4File . " and its record have been deleted successfully."; // Redirect to index.php after deletion header("Location: index.php"); exit(); // Ensure that no other content is sent after the header redirection } else { echo "Error deleting record: " . $conn->error; } } else { echo "MP4 file not found."; } $conn->close(); } ?>