From d41519ba91b86dffbb1e952f44cb83cf575e7caf Mon Sep 17 00:00:00 2001 From: Rod Wright Date: Thu, 19 Feb 2026 21:21:50 -0500 Subject: [PATCH] Updated to use fix_date and fix_time functions --- distfiles/logentry.php | 11 +++++++---- distfiles/maintformentry.php | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/distfiles/logentry.php b/distfiles/logentry.php index babe693..4bb7d71 100644 --- a/distfiles/logentry.php +++ b/distfiles/logentry.php @@ -96,10 +96,9 @@ if ($add) { // add the entry if submit is pressed if ($note) { // sanitize and fix blank date and time - $date = mysqli_real_escape_string($db, $date); - $time = mysqli_real_escape_string($db, $time); - if (!$date) $date = $today; - if (!$time) $time = $now; + $date = fix_date($date); + $time = fix_time($time); + // determine whether supplied date is future or past $datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$date\",CURRENT_DATE)")); // if future, set time to 00:00:01, if past, set to 23:59:59 @@ -263,6 +262,10 @@ if ($edit) { if ($removepart && $authorized) mysqli_query($db, "delete from logparts where lognoteid=\"$noteid\" and logpartid=\"$removepart\""); if ($submit) { if ($note) { + // sanitize and fix blank date and time + $date = fix_date($date); + $time = fix_time($time); + // remove cruft from note text $note = strip_tags($note, ""); $note = mysqli_real_escape_string($db, $note); diff --git a/distfiles/maintformentry.php b/distfiles/maintformentry.php index fdd2ff8..0d16adf 100644 --- a/distfiles/maintformentry.php +++ b/distfiles/maintformentry.php @@ -135,6 +135,9 @@ if ($mfadd) { if ($mfsubmit) { // add the entry if submit is pressed if ($mfmalfunction && ($uid || ($partnum && $sernum))) { + // sanitize and fix blank date and time + $mfdate = fix_date($mfdate); + $mftime = fix_time($mftime); // determine whether supplied date is future or past $datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$mfdate\",CURRENT_DATE)")); // if future, set time to 00:00:01, if past, set to 23:59:59 @@ -236,6 +239,9 @@ if ($mfdelete && $mfauthorized) { if ($actionadd) { if ($actionaddsubmit) { if ($action) { + // sanitize and fix blank date and time + $actiondate = fix_date($actiondate); + $actiontime = fix_time($actiontime); // determine whether supplied date is future or past $datediff = mysqli_fetch_row(mysqli_query($db, "select datediff(\"$actiondate\",CURRENT_DATE)")); // if future, set time to 00:00:01, if past, set to 23:59:59 @@ -260,6 +266,9 @@ if ($actionadd) { if ($actionedit) { if ($actioneditsubmit && $actionauthorized) { // update the action + // sanitize and fix blank date and time + $actiondate = fix_date($actiondate); + $actiontime = fix_time($actiontime); // remove cruft from action text $action = htmlentities($action); $action = addslashes($action);