Server IP : 142.132.252.48 / Your IP : 216.73.216.255 Web Server : LiteSpeed System : Linux panel555.harmondns.net 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : nmgsjour ( 1446) PHP Version : 7.4.33 Disable Function : mail, show_source, system, shell_exec, passthru, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/nmgsjour/public_html/journal/ |
Upload File : |
<?php require('conn.php'); // Downloads files if (isset($_GET['file_id'])) { echo $id = $_GET['file_id']; // fetch file to download from database $sql = "SELECT * FROM journals WHERE id=$id"; $result = mysqli_query($conn, $sql); $file = mysqli_fetch_assoc($result); echo $filepath = $file['file']; if (file_exists($filepath)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($filepath)); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file['file'])); readfile($file['file']); // Now update downloads count $newCount = $file['downloads'] + 1; $updateQuery = "UPDATE journals SET downloads=$newCount WHERE id=$id"; mysqli_query($conn, $updateQuery); exit; } } ?>