diff --git a/api.asp b/api.asp index 30cf0da..180a931 100644 --- a/api.asp +++ b/api.asp @@ -49,6 +49,10 @@ Select Case action GetRecordedIP() Case "updateMachinePositions" UpdateMachinePositions() + Case "logDNCEvent" + LogDNCEvent() + Case "getDNCStats" + GetDNCStats() Case Else SendError "Invalid action: " & action End Select @@ -2541,4 +2545,153 @@ Sub UpdateMachinePositions() End If End Sub +' ============================================================================ +' eDNC SPECIAL CHARACTER FIX - LOGGING +' ============================================================================ + +Sub LogDNCEvent() + On Error Resume Next + + ' Get parameters + Dim hostname, filename, eventAction, bytesRemoved, version, message, watchFolder, fileFilter + hostname = Trim(Request.Form("hostname") & "") + filename = Trim(Request.Form("filename") & "") + eventAction = Trim(Request.Form("eventType") & "") + bytesRemoved = Request.Form("bytesRemoved") + version = Trim(Request.Form("version") & "") + message = Trim(Request.Form("message") & "") + watchFolder = Trim(Request.Form("watchFolder") & "") + fileFilter = Trim(Request.Form("fileFilter") & "") + + ' Validate required fields + If hostname = "" Or eventAction = "" Then + SendError "hostname and eventType are required" + Exit Sub + End If + + ' Sanitize inputs + Dim safeHostname, safeFilename, safeAction, safeVersion, safeMessage, safeWatchFolder, safeFileFilter + safeHostname = Replace(hostname, "'", "''") + safeFilename = Replace(filename, "'", "''") + safeAction = Replace(eventAction, "'", "''") + safeVersion = Replace(version, "'", "''") + safeMessage = Replace(message, "'", "''") + safeWatchFolder = Replace(watchFolder, "'", "''") + safeFileFilter = Replace(fileFilter, "'", "''") + + ' Default bytesRemoved to 0 if not numeric + If Not IsNumeric(bytesRemoved) Or bytesRemoved = "" Then bytesRemoved = 0 + + ' Insert log entry + Dim insertSQL + insertSQL = "INSERT INTO ednc_logs (hostname, filename, action, bytes_removed, version, message) " & _ + "VALUES ('" & safeHostname & "', '" & safeFilename & "', '" & safeAction & "', " & _ + CLng(bytesRemoved) & ", '" & safeVersion & "', '" & safeMessage & "')" + objConn.Execute insertSQL + + If Err.Number <> 0 Then + SendError "Failed to log event: " & Err.Description + Exit Sub + End If + + ' Update or insert installation record + Dim checkSQL, rsCheck + checkSQL = "SELECT installid, total_cleaned, total_failed FROM ednc_installations WHERE hostname = '" & safeHostname & "'" + Set rsCheck = objConn.Execute(checkSQL) + + If rsCheck.EOF Then + ' New installation - INSERT + Dim installSQL + installSQL = "INSERT INTO ednc_installations (hostname, version, watch_folder, file_filter, total_cleaned, total_failed) " & _ + "VALUES ('" & safeHostname & "', '" & safeVersion & "', '" & safeWatchFolder & "', '" & safeFileFilter & "', " + If eventAction = "cleaned" Then + installSQL = installSQL & "1, 0)" + ElseIf eventAction = "failed" Or eventAction = "error" Then + installSQL = installSQL & "0, 1)" + Else + installSQL = installSQL & "0, 0)" + End If + objConn.Execute installSQL + Else + ' Existing installation - UPDATE + Dim totalCleaned, totalFailed, updateSQL + totalCleaned = CLng(rsCheck("total_cleaned")) + totalFailed = CLng(rsCheck("total_failed")) + + If eventAction = "cleaned" Then + totalCleaned = totalCleaned + 1 + ElseIf eventAction = "failed" Or eventAction = "error" Then + totalFailed = totalFailed + 1 + End If + + updateSQL = "UPDATE ednc_installations SET " & _ + "version = '" & safeVersion & "', " & _ + "last_seen = NOW(), " & _ + "total_cleaned = " & totalCleaned & ", " & _ + "total_failed = " & totalFailed + If safeWatchFolder <> "" Then + updateSQL = updateSQL & ", watch_folder = '" & safeWatchFolder & "'" + End If + If safeFileFilter <> "" Then + updateSQL = updateSQL & ", file_filter = '" & safeFileFilter & "'" + End If + updateSQL = updateSQL & " WHERE hostname = '" & safeHostname & "'" + objConn.Execute updateSQL + End If + rsCheck.Close + Set rsCheck = Nothing + + ' Send success response + Response.Write "{""success"":true,""message"":""Event logged""}" +End Sub + +Sub GetDNCStats() + On Error Resume Next + + ' Get installations with recent activity + Dim sql, rs + sql = "SELECT i.hostname, i.version, i.watch_folder, i.file_filter, " & _ + "i.first_seen, i.last_seen, i.is_active, i.total_cleaned, i.total_failed, " & _ + "(SELECT COUNT(*) FROM ednc_logs l WHERE l.hostname = i.hostname AND l.created > DATE_SUB(NOW(), INTERVAL 24 HOUR)) AS events_24h " & _ + "FROM ednc_installations i ORDER BY i.last_seen DESC" + + Set rs = objConn.Execute(sql) + + If Err.Number <> 0 Then + SendError "Database error: " & Err.Description + Exit Sub + End If + + ' Build JSON response + Dim json, first + json = "{""success"":true,""installations"":[" + first = True + + Do While Not rs.EOF + If Not first Then json = json & "," + first = False + + json = json & "{" & _ + """hostname"":""" & (rs("hostname") & "") & """," & _ + """version"":""" & (rs("version") & "") & """," & _ + """watchFolder"":""" & Replace(rs("watch_folder") & "", "\", "\\") & """," & _ + """fileFilter"":""" & (rs("file_filter") & "") & """," & _ + """firstSeen"":""" & (rs("first_seen") & "") & """," & _ + """lastSeen"":""" & (rs("last_seen") & "") & """," & _ + """isActive"":" & rs("is_active") & "," & _ + """totalCleaned"":" & rs("total_cleaned") & "," & _ + """totalFailed"":" & rs("total_failed") & "," & _ + """events24h"":" & rs("events_24h") & _ + "}" + rs.MoveNext + Loop + + json = json & "]}" + + rs.Close + Set rs = Nothing + + Response.Write json +End Sub + %> diff --git a/displaypc.asp b/displaypc.asp index a2d3b42..cec0d1f 100644 --- a/displaypc.asp +++ b/displaypc.asp @@ -733,6 +733,73 @@ End If + + +<% + '============================================================================= + ' eDNC-Fix Installation Stats for this PC + '============================================================================= + Dim edncSQL, rsEdnc, hasEdnc + hasEdnc = False + edncSQL = "SELECT i.version, i.watch_folder, i.file_filter, i.first_seen, i.last_seen, " & _ + "i.total_cleaned, i.total_failed, " & _ + "(SELECT COUNT(*) FROM ednc_logs l WHERE l.hostname = i.hostname AND l.created > DATE_SUB(NOW(), INTERVAL 24 HOUR)) AS events_24h, " & _ + "(SELECT MAX(created) FROM ednc_logs l WHERE l.hostname = i.hostname AND l.action = 'cleaned') AS last_cleaned " & _ + "FROM ednc_installations i " & _ + "INNER JOIN machines m ON UPPER(i.hostname) = UPPER(m.hostname) " & _ + "WHERE m.machineid = ?" + Set rsEdnc = ExecuteParameterizedQuery(objConn, edncSQL, Array(machineid)) + If Not rsEdnc.EOF Then + hasEdnc = True +%> +
eDNC Special Character Fix
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Version<%= Server.HTMLEncode(rsEdnc("version") & "") %>
Watch Folder<%= Server.HTMLEncode(rsEdnc("watch_folder") & "") %>
File Filter<%= Server.HTMLEncode(rsEdnc("file_filter") & "") %>
First Seen<%= rsEdnc("first_seen") %>
Last Active<%= rsEdnc("last_seen") %>
Files Cleaned (Total)<%= rsEdnc("total_cleaned") %>
Files Failed (Total) 0, "danger", "secondary") %>"><%= rsEdnc("total_failed") %>
Events (Last 24h)<%= rsEdnc("events_24h") %>
Last File Cleaned<%= rsEdnc("last_cleaned") & "" %>
+
+<% + End If + rsEdnc.Close + Set rsEdnc = Nothing +%> diff --git a/images/12.jpg b/images/12.jpg index 778fef8..3795a54 100644 Binary files a/images/12.jpg and b/images/12.jpg differ diff --git a/images/15.jpg b/images/15.jpg new file mode 100644 index 0000000..ad1b430 Binary files /dev/null and b/images/15.jpg differ diff --git a/images/Thumbs.db b/images/Thumbs.db index 8809900..def9cf7 100644 Binary files a/images/Thumbs.db and b/images/Thumbs.db differ diff --git a/images/applications/FAMS.png b/images/applications/FAMS.png new file mode 100644 index 0000000..e39e5e0 Binary files /dev/null and b/images/applications/FAMS.png differ diff --git a/images/applications/Savyint.png b/images/applications/Savyint.png index fd35afb..854e691 100644 Binary files a/images/applications/Savyint.png and b/images/applications/Savyint.png differ diff --git a/images/applications/Thumbs.db b/images/applications/Thumbs.db index 608679f..5d7523a 100644 Binary files a/images/applications/Thumbs.db and b/images/applications/Thumbs.db differ diff --git a/images/applications/avigilon.png b/images/applications/avigilon.png index 0766de4..db7b0d0 100644 Binary files a/images/applications/avigilon.png and b/images/applications/avigilon.png differ diff --git a/images/applications/gelearning.png b/images/applications/gelearning.png new file mode 100644 index 0000000..07ca52c Binary files /dev/null and b/images/applications/gelearning.png differ diff --git a/images/applications/gensuite.png b/images/applications/gensuite.png new file mode 100644 index 0000000..2521ec0 Binary files /dev/null and b/images/applications/gensuite.png differ diff --git a/images/applications/impact.png b/images/applications/impact.png new file mode 100644 index 0000000..45109cc Binary files /dev/null and b/images/applications/impact.png differ diff --git a/images/applications/m365.png b/images/applications/m365.png new file mode 100644 index 0000000..8e368dd Binary files /dev/null and b/images/applications/m365.png differ diff --git a/images/applications/maximo.png b/images/applications/maximo.png new file mode 100644 index 0000000..8fdd0ad Binary files /dev/null and b/images/applications/maximo.png differ diff --git a/images/applications/rightcrowd.png b/images/applications/rightcrowd.png new file mode 100644 index 0000000..0586abe Binary files /dev/null and b/images/applications/rightcrowd.png differ diff --git a/images/applications/travel.png b/images/applications/travel.png new file mode 100644 index 0000000..b254131 Binary files /dev/null and b/images/applications/travel.png differ diff --git a/images/applications/workday.png b/images/applications/workday.png new file mode 100644 index 0000000..be53a9c Binary files /dev/null and b/images/applications/workday.png differ diff --git a/images/applications/zscaler.jpg b/images/applications/zscaler.jpg index 81978b9..cd51b72 100644 Binary files a/images/applications/zscaler.jpg and b/images/applications/zscaler.jpg differ diff --git a/images/machines/7107sf.png b/images/machines/7107sf.png new file mode 100644 index 0000000..2402fbb Binary files /dev/null and b/images/machines/7107sf.png differ diff --git a/images/machines/Cisco9120.png b/images/machines/Cisco9120.png new file mode 100644 index 0000000..979b31f Binary files /dev/null and b/images/machines/Cisco9120.png differ diff --git a/images/machines/IDF.png b/images/machines/IDF.png new file mode 100644 index 0000000..62a17f7 Binary files /dev/null and b/images/machines/IDF.png differ diff --git a/images/machines/OptiPlex-7070.png b/images/machines/OptiPlex-7070.png new file mode 100644 index 0000000..2489079 Binary files /dev/null and b/images/machines/OptiPlex-7070.png differ diff --git a/images/machines/Optiplex-7000.png b/images/machines/Optiplex-7000.png new file mode 100644 index 0000000..8b99888 Binary files /dev/null and b/images/machines/Optiplex-7000.png differ diff --git a/images/machines/Thumbs.db b/images/machines/Thumbs.db index de37249..f7c898d 100644 Binary files a/images/machines/Thumbs.db and b/images/machines/Thumbs.db differ diff --git a/images/machines/abtech-eas1000.png b/images/machines/abtech-eas1000.png new file mode 100644 index 0000000..c1d59e3 Binary files /dev/null and b/images/machines/abtech-eas1000.png differ diff --git a/images/machines/abtech-eas1000.webp b/images/machines/abtech-eas1000.webp new file mode 100644 index 0000000..e7bba90 Binary files /dev/null and b/images/machines/abtech-eas1000.webp differ diff --git a/images/machines/keyence-vr3100.png b/images/machines/keyence-vr3100.png new file mode 100644 index 0000000..0d6512d Binary files /dev/null and b/images/machines/keyence-vr3100.png differ diff --git a/images/machines/latitude5440.png b/images/machines/latitude5440.png new file mode 100644 index 0000000..b44f165 Binary files /dev/null and b/images/machines/latitude5440.png differ diff --git a/images/machines/leandrum.jpg b/images/machines/leandrum.jpg new file mode 100644 index 0000000..e171961 Binary files /dev/null and b/images/machines/leandrum.jpg differ diff --git a/images/machines/phoenixbroach.png b/images/machines/phoenixbroach.png new file mode 100644 index 0000000..6e5307c Binary files /dev/null and b/images/machines/phoenixbroach.png differ diff --git a/images/machines/precision5560.jpg b/images/machines/precision5560.jpg new file mode 100644 index 0000000..66cf930 Binary files /dev/null and b/images/machines/precision5560.jpg differ diff --git a/images/machines/rb2.png b/images/machines/rb2.png new file mode 100644 index 0000000..270a9b6 Binary files /dev/null and b/images/machines/rb2.png differ diff --git a/images/machines/vt5502sp.png b/images/machines/vt5502sp.png index 8de2e48..dc1d8d6 100644 Binary files a/images/machines/vt5502sp.png and b/images/machines/vt5502sp.png differ diff --git a/images/printers/LaserJet-Pro-M252dw.png b/images/printers/LaserJet-Pro-M252dw.png new file mode 100644 index 0000000..2be6f9d Binary files /dev/null and b/images/printers/LaserJet-Pro-M252dw.png differ diff --git a/images/printers/Laserjet-Pro-M251nw.png b/images/printers/Laserjet-Pro-M251nw.png new file mode 100644 index 0000000..df165dc Binary files /dev/null and b/images/printers/Laserjet-Pro-M251nw.png differ diff --git a/images/printers/Thumbs.db b/images/printers/Thumbs.db index bd40e2d..f0c17b4 100644 Binary files a/images/printers/Thumbs.db and b/images/printers/Thumbs.db differ diff --git a/images/printers/Versalink-C405.png b/images/printers/Versalink-C405.png index 9d87142..262a3a3 100644 Binary files a/images/printers/Versalink-C405.png and b/images/printers/Versalink-C405.png differ diff --git a/sql/ednc_tables.sql b/sql/ednc_tables.sql new file mode 100644 index 0000000..395915e --- /dev/null +++ b/sql/ednc_tables.sql @@ -0,0 +1,41 @@ +-- ============================================================================ +-- eDNC Special Character Fix - Database Tables +-- Run on PRODUCTION database to enable eDNC logging +-- Created: 2025-12-12 +-- ============================================================================ + +-- Log individual events (cleaned, failed, started, stopped, etc.) +CREATE TABLE IF NOT EXISTS ednc_logs ( + logid INT AUTO_INCREMENT PRIMARY KEY, + hostname VARCHAR(50) NOT NULL, + filename VARCHAR(255) NOT NULL, + action ENUM('cleaned', 'ok', 'failed', 'error', 'started', 'stopped') NOT NULL, + bytes_removed INT DEFAULT 0, + version VARCHAR(20), + message VARCHAR(500), + created DATETIME DEFAULT CURRENT_TIMESTAMP, + INDEX idx_hostname (hostname), + INDEX idx_created (created), + INDEX idx_action (action) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- Track installations per PC +CREATE TABLE IF NOT EXISTS ednc_installations ( + installid INT AUTO_INCREMENT PRIMARY KEY, + hostname VARCHAR(50) NOT NULL UNIQUE, + version VARCHAR(20), + watch_folder VARCHAR(255), + file_filter VARCHAR(50), + first_seen DATETIME DEFAULT CURRENT_TIMESTAMP, + last_seen DATETIME DEFAULT CURRENT_TIMESTAMP, + is_active TINYINT(1) DEFAULT 1, + total_cleaned INT DEFAULT 0, + total_failed INT DEFAULT 0, + INDEX idx_hostname (hostname), + INDEX idx_active (is_active) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- Verify tables created +SELECT 'ednc_logs' AS table_name, COUNT(*) AS row_count FROM ednc_logs +UNION ALL +SELECT 'ednc_installations', COUNT(*) FROM ednc_installations;