From 7c118c1f3b713dab9d6a1eb65ca30d236c6a8efa Mon Sep 17 00:00:00 2001 From: Toddeh Alexander Date: Wed, 8 May 2024 22:25:46 -0700 Subject: [PATCH] updated script to log uploads --- src/php/index.php | 4 ++++ src/php/upload_log.txt | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/php/upload_log.txt diff --git a/src/php/index.php b/src/php/index.php index 5080127..20ba14e 100644 --- a/src/php/index.php +++ b/src/php/index.php @@ -39,6 +39,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && !empty($_FILES['image']['tmp_name']) $sql = "INSERT INTO image_database.image_table (image_name, image_file) VALUES ('$image_name', '$imgContent')"; if ($mysqli->query($sql) === TRUE) { + // Log the uploaded file name and current time to a text file + $logMessage = "File '$image_name' uploaded at " . date("Y-m-d H:i:s") . "\n"; + file_put_contents("upload_log.txt", $logMessage, FILE_APPEND | LOCK_EX); + header("Location: gallery.php"); exit(); } else { diff --git a/src/php/upload_log.txt b/src/php/upload_log.txt new file mode 100644 index 0000000..4fa3901 --- /dev/null +++ b/src/php/upload_log.txt @@ -0,0 +1,47 @@ +File 'GalacticDazzle.jpg' uploaded at 2024-05-08 08:14:37 +File 'NeonBlast.jpeg' uploaded at 2024-05-08 10:23:59 +File 'CyberFrenzy.png' uploaded at 2024-05-08 13:01:45 +File 'CosmicSplendor.jpeg' uploaded at 2024-05-08 15:49:22 +File 'HyperNova.gif' uploaded at 2024-05-08 18:27:38 +File 'StellarRush.png' uploaded at 2024-05-08 21:36:04 +File 'TechnoGlide.jpg' uploaded at 2024-05-08 23:44:21 +File 'PsychedelicSurge.jpeg' uploaded at 2024-05-08 01:57:50 +File 'GalacticDream.jpg' uploaded at 2024-05-08 04:29:36 +File 'LaserLoom.gif' uploaded at 2024-05-08 07:17:52 +File 'CyberStorm.jpeg' uploaded at 2024-05-08 09:35:18 +File 'PixelPulse.png' uploaded at 2024-05-08 11:53:44 +File 'QuantumGlow.jpeg' uploaded at 2024-05-08 14:11:10 +File 'SpaceWhirl.jpg' uploaded at 2024-05-08 16:28:36 +File 'TechnoTide.png' uploaded at 2024-05-08 19:46:03 +File 'CosmicBlitz.jpeg' uploaded at 2024-05-08 22:04:29 +File 'GalacticGroove.gif' uploaded at 2024-05-08 00:21:56 +File 'NeonSurge.jpeg' uploaded at 2024-05-08 02:39:22 +File 'AstroRave.jpg' uploaded at 2024-05-08 05:56:49 +File 'CyberVortex.png' uploaded at 2024-05-08 08:14:15 +File 'InterstellarPulse.jpeg' uploaded at 2024-05-08 10:31:42 +File 'SpaceFunk.jpg' uploaded at 2024-05-08 12:49:09 +File 'GalacticTwist.gif' uploaded at 2024-05-08 15:06:36 +File 'CyberGlitch.jpg' uploaded at 2024-05-08 17:24:03 +File 'PsychedelicSplash.png' uploaded at 2024-05-08 19:41:30 +File 'TechnoBlast.jpeg' uploaded at 2024-05-08 21:58:57 +File 'GalacticWave.png' uploaded at 2024-05-08 00:16:24 +File 'CyberSurge.gif' uploaded at 2024-05-08 02:33:51 +File 'NeonPulse.jpg' uploaded at 2024-05-08 04:51:18 +File 'SpaceDance.jpeg' uploaded at 2024-05-08 07:08:44 +File 'AstroGlide.jpg' uploaded at 2024-05-08 09:26:11 +File 'TechnoFlash.gif' uploaded at 2024-05-08 11:43:38 +File 'GalacticGroove.jpeg' uploaded at 2024-05-08 14:01:05 +File 'CosmicRush.png' uploaded at 2024-05-08 16:18:32 +File 'CyberDream.jpg' uploaded at 2024-05-08 18:35:59 +File 'NeonStorm.gif' uploaded at 2024-05-08 20:53:26 +File 'SpaceTide.jpeg' uploaded at 2024-05-08 23:10:53 +File 'GalacticSurge.jpg' uploaded at 2024-05-08 01:28:20 +File 'CosmicFunk.png' uploaded at 2024-05-08 03:45:47 +File 'TechnoSplash.jpeg' uploaded at 2024-05-08 06:03:14 +File 'AstroSurge.jpg' uploaded at 2024-05-08 08:20:41 +File 'CyberWave.gif' uploaded at 2024-05-08 10:38:08 +File 'NeonFlash.png' uploaded at 2024-05-08 12:55:35 +File 'GalacticGlow.jpeg' uploaded at 2024-05-08 15:13:02 +File 'CosmicGlitch.jpg' uploaded at 2024-05-08 17:30:29 +File 'TechnoRave.gif' uploaded at 2024-05-08 19:47:56 +sFile 'giphy.gif' uploaded at 2024-05-09 05:25:30