D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
filter.php
back
Copy
<?php include "../config.php"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Strat Learning Quran online</title> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta content="Learn Quran,Quran Teaching,online Quran tutors,female Quran Tutors contact,Quran class Online" name="keywords"> <meta content="Online Quran class for kids and adults,Male and female Quran tutors" name="description"> <style> /* CSS Styles for Audio Table */ .audio-table { width: 100%; border-collapse: collapse; } .audio-table th, .audio-table td { border: 1px solid #ddd; padding: 8px; text-align: left; } .audio-table th { background-color: #f2f2f2; } .audio-table tr:nth-child(even) { background-color: #f9f9f9; } .audio-table tr:hover { background-color: #f1f1f1; }</style> </head> <?php // Include the config file to establish a database connection // Check if year and month are set in the form if(isset($_POST['year']) && isset($_POST['month'])) { // Sanitize user input $year = mysqli_real_escape_string($conn, $_POST['year']); $month = mysqli_real_escape_string($conn, $_POST['month']); // Query to filter by year and month $sql = "SELECT * FROM audio_files WHERE YEAR(a_date) = '$year'"; // If month is provided, include month in the query if($month !== '') { $sql .= " AND MONTH(a_date) = '$month'"; } // Execute the query $result = mysqli_query($conn, $sql); // Check if query was successful if($result) { // Display audio files in a table format echo "<table class='audio-table'>"; echo "<tr><th>English Title</th><th>Speaker</th><th>Category</th><th>Date</th><th>Download</th><th>File Size</th></tr>"; while($row = mysqli_fetch_assoc($result)) { // Get file size in megabytes $filePath = 'uploads/audio/' . $row['audio_filename']; // Update the file path $fileSizeMB = '-'; if(file_exists($filePath)) { $fileSizeBytes = filesize($filePath); $fileSizeMB = round($fileSizeBytes / (1024 * 1024), 2); // Calculate file size in MB } // Display each audio file's details in a table row echo "<tr>"; echo "<td>" . $row['english_title'] . "</td>"; echo "<td>" . $row['speaker'] . "</td>"; echo "<td>" . $row['category'] . "</td>"; echo "<td>" . $row['a_date'] . "</td>"; echo "<td><a href='" . $filePath . "' download>Download</a></td>"; // Download link echo "<td>" . ($fileSizeMB !== '-' ? $fileSizeMB . " MB" : "N/A") . "</td>"; // File size in MB echo "</tr>"; } echo "</table>"; } else { echo "Error: " . mysqli_error($conn); } // Close database connection mysqli_close($conn); } else { echo "Please provide both year and month."; } ?>