From dbd40496f35a418eacb33b42f100221a358fbf29 Mon Sep 17 00:00:00 2001 From: Chad Bentz <1760475+felickz@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:31:04 -0400 Subject: [PATCH] Implement getWeatherInfo function for station data Added a function to fetch weather station data based on the provided station ID. --- .../single/NumericSQLInjection/feature.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 challenges/single/NumericSQLInjection/feature.php diff --git a/challenges/single/NumericSQLInjection/feature.php b/challenges/single/NumericSQLInjection/feature.php new file mode 100644 index 0000000..75d5c4a --- /dev/null +++ b/challenges/single/NumericSQLInjection/feature.php @@ -0,0 +1,16 @@ +/** + * Function to fetch station data + * + * @param int $id Station Id + * + * @return array Result of database query + */ +private function getWeatherInfo($id = null) +{ + + if ($id == null) { + return \jf::SQL("SELECT * FROM ".self::TABLE_NAME); + } else { + return \jf::SQL("SELECT * FROM ".self::TABLE_NAME. " WHERE station = ".$id); //Notice the concatenation + } +}