% theme = Request.Cookies("theme") IF theme = "" THEN theme="bg-theme1" END IF ' Get and validate machineid parameter (Phase 2: PCs are in machines table) Dim machineid, machineData, strSQL machineid = Request.QueryString("machineid") ' Security validation - ensure pcid is numeric If NOT IsNumeric(machineid) OR machineid = "" Then Response.Redirect("./displaypcs.asp") Response.End End If ' Load PC data (pctypeid IS NOT NULL identifies PCs) strSQL = "SELECT m.*, m.machinetypeid AS pcmachinetypeid, " &_ "mo.modelnumber, mo.vendorid AS modelvendorid, mo.machinetypeid AS modelmachinetypeid, 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 = ? AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" 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("./displaypcs.asp") Response.End End If ' Store machine data Dim serialnumber, hostname, machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, pcMachineTypeId, currentMachineStatusId serialnumber = "" : If NOT IsNull(rsMachine("serialnumber")) Then serialnumber = rsMachine("serialnumber") & "" hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & "" 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") pcMachineTypeId = 0 : If NOT IsNull(rsMachine("pcmachinetypeid")) Then pcMachineTypeId = CLng(rsMachine("pcmachinetypeid")) currentMachineStatusId = "" : If NOT IsNull(rsMachine("machinestatusid")) Then currentMachineStatusId = rsMachine("machinestatusid") 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 controlled machines from machinerelationships (for PC edit page) ' Note: Controls relationship is PC → Equipment, so we show machines where machineid is THIS PC Dim controllingpcid controllingpcid = "" strSQL = "SELECT mr.related_machineid AS controlpcid FROM machinerelationships mr " &_ "JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " &_ "WHERE mr.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("dodassettype")) Then dodassettype = rsCompliance("dodassettype") End If rsCompliance.Close Set rsCompliance = Nothing Set cmd = Nothing %>