% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF ' Get and validate machineid parameter Dim machineid, machineData, strSQL machineid = Request.QueryString("machineid") ' Security validation - ensure machineid is numeric If NOT IsNumeric(machineid) OR machineid = "" Then Response.Redirect("./displaymachines.asp") Response.End End If ' Load machine data strSQL = "SELECT m.*, " &_ "mo.modelnumber, mo.vendorid AS modelvendorid, mo.machinetypeid, mo.image AS modelimage, " &_ "v.vendor, " &_ "bu.businessunit, " &_ "mt.machinetype " &_ "FROM machines m " &_ "LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " &_ "LEFT JOIN vendors v ON mo.vendorid = v.vendorid " &_ "LEFT JOIN businessunits bu ON m.businessunitid = bu.businessunitid " &_ "LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " &_ "WHERE m.machineid = ?" Dim cmd, rsMachine Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Set rsMachine = cmd.Execute If rsMachine.EOF Then rsMachine.Close Set rsMachine = Nothing Set cmd = Nothing objConn.Close Response.Redirect("./displaymachines.asp") Response.End End If ' Store machine data Dim machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, fqdn machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & "" modelid = "" : If NOT IsNull(rsMachine("modelnumberid")) Then modelid = rsMachine("modelnumberid") businessunitid = "" : If NOT IsNull(rsMachine("businessunitid")) Then businessunitid = rsMachine("businessunitid") alias = "" : If NOT IsNull(rsMachine("alias")) Then alias = rsMachine("alias") & "" machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & "" mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft") maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop") fqdn = "" : If NOT IsNull(rsMachine("fqdn")) Then fqdn = rsMachine("fqdn") & "" rsMachine.Close Set rsMachine = Nothing Set cmd = Nothing ' Load network interfaces from communications table Dim ip1, mac1, ip2, mac2, ip3, mac3 ip1 = "" : mac1 = "" : ip2 = "" : mac2 = "" : ip3 = "" : mac3 = "" strSQL = "SELECT address, macaddress FROM communications WHERE machineid = ? AND isactive = 1 ORDER BY isprimary DESC" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsComms Set rsComms = cmd.Execute Dim interfaceCount interfaceCount = 0 While NOT rsComms.EOF AND interfaceCount < 3 interfaceCount = interfaceCount + 1 If interfaceCount = 1 Then If NOT IsNull(rsComms("address")) Then ip1 = rsComms("address") If NOT IsNull(rsComms("macaddress")) Then mac1 = rsComms("macaddress") ElseIf interfaceCount = 2 Then If NOT IsNull(rsComms("address")) Then ip2 = rsComms("address") If NOT IsNull(rsComms("macaddress")) Then mac2 = rsComms("macaddress") ElseIf interfaceCount = 3 Then If NOT IsNull(rsComms("address")) Then ip3 = rsComms("address") If NOT IsNull(rsComms("macaddress")) Then mac3 = rsComms("macaddress") End If rsComms.MoveNext Wend rsComms.Close Set rsComms = Nothing Set cmd = Nothing ' Load controlling PC from machinerelationships ' Note: Controls relationship is PC → Equipment, so we need machineid (PC) where related_machineid is this equipment Dim controllingpcid controllingpcid = "" strSQL = "SELECT mr.machineid AS controlpcid FROM machinerelationships mr " &_ "JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_ "WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Controls' AND mr.isactive = 1" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsControlPC Set rsControlPC = cmd.Execute If NOT rsControlPC.EOF Then If NOT IsNull(rsControlPC("controlpcid")) Then controllingpcid = rsControlPC("controlpcid") End If rsControlPC.Close Set rsControlPC = Nothing Set cmd = Nothing ' Load dualpath from machinerelationships Dim dualpathid dualpathid = "" strSQL = "SELECT related_machineid FROM machinerelationships mr " &_ "JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_ "WHERE mr.machineid = ? AND rt.relationshiptype = 'Dualpath' AND mr.isactive = 1" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsDualpath Set rsDualpath = cmd.Execute If NOT rsDualpath.EOF Then If NOT IsNull(rsDualpath("related_machineid")) Then dualpathid = rsDualpath("related_machineid") End If rsDualpath.Close Set rsDualpath = Nothing Set cmd = Nothing ' Load compliance data Dim thirdpartymanaged, thirdpartymanager, otassetsystem, dodassettype thirdpartymanaged = "NA" : thirdpartymanager = "" : otassetsystem = "" : dodassettype = "" strSQL = "SELECT * FROM compliance WHERE machineid = ?" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = objConn cmd.CommandText = strSQL cmd.CommandType = 1 cmd.Parameters.Append cmd.CreateParameter("@machineid", 3, 1, , machineid) Dim rsCompliance Set rsCompliance = cmd.Execute If NOT rsCompliance.EOF Then If NOT IsNull(rsCompliance("isthirdpartymanaged")) Then thirdpartymanaged = rsCompliance("isthirdpartymanaged") If NOT IsNull(rsCompliance("thirdpartymanager")) Then thirdpartymanager = rsCompliance("thirdpartymanager") If NOT IsNull(rsCompliance("otassetdevicetype")) Then dodassettype = rsCompliance("otassetdevicetype") End If rsCompliance.Close Set rsCompliance = Nothing Set cmd = Nothing %>