Files
shopdb/printerlookup.asp
cproudlock 95bd2b591d Add printer lookup page and fiscal week theme styling
- Add printerlookup.asp for Zabbix integration (lookup by IP/FQDN)
- Add fiscal week sidebar styling for all 16 themes
- Update CLAUDE.md with External Integrations section
- Fix fiscal week box centering with inline styles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 16:56:08 -05:00

41 lines
1.1 KiB
Plaintext

<%@ Language="VBScript" %>
<%
Option Explicit
Response.Buffer = True
%>
<!--#include file="includes/sql.asp"-->
<%
' Lookup printer by IP address or FQDN and redirect to displayprinter.asp
' Used by Zabbix to link directly to printer details
Dim ip, fqdn, lookupValue, cmd, rs
ip = Trim(Request.QueryString("ip") & "")
fqdn = Trim(Request.QueryString("fqdn") & "")
If ip <> "" Then
lookupValue = ip
ElseIf fqdn <> "" Then
lookupValue = fqdn
Else
Response.Write "No IP or FQDN provided. Usage: printerlookup.asp?ip=x.x.x.x or printerlookup.asp?fqdn=hostname"
Response.End
End If
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = objConn
cmd.CommandText = "SELECT printerid FROM printers WHERE address = ? AND isactive = 1"
cmd.Parameters.Append cmd.CreateParameter("@addr", 200, 1, 100, lookupValue)
Set rs = cmd.Execute()
If Not rs.EOF Then
Response.Redirect "displayprinter.asp?printerid=" & rs("printerid")
Else
Response.Write "Printer not found: " & Server.HTMLEncode(lookupValue)
End If
rs.Close
Set rs = Nothing
Set cmd = Nothing
objConn.Close
%>