prepare($query); if($sth) { $res = $sth->execute(); $numRows = $sth->rows(); } else { PRINT "Could not prepare query: ".$sth->errstr."
\n"; } if ($numRows == 0) { $ID = $reqID; } else { commonHeader("Error"); PRINT "A server with ID $reqID already exists. Please pick a new ID"; commonFooter(); exit(); } } if ($reqID == 0) { $ID = "NULL"; } $comments = addslashes($comments); include_once("../include/servers.inc"); $query = "INSERT INTO computers set id='$ID', $querystring"; $count = $adb->dbh_do($query); $query = "SELECT ID FROM computers WHERE (date_mod = '$date_mod')"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $result = $sth->fetchrow_hash(); $cID = $result["ID"]; } else { PRINT "Could not prepare query: ".$sth->errstr."
\n"; } logevent($cID, "servers", 4, "database", "Server added by $IRMName"); $query = "SELECT * FROM templ_inst_software WHERE (cID = $templID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $numRows = $sth->rows(); if ($iface_do == "yes") { $query = "INSERT INTO networking_ports VALUES (NULL, $cID, 1, '$iface', '$ip', '$mac', 1, 'Port 1', 0)"; $count = $adb->dbh_do($query); } for($i = 0; $i < $numRows; $i++) { $result = $sth->fetchrow_hash(); $sID = $result["sID"]; $query = "INSERT INTO inst_software VALUES (NULL, $cID, $sID)"; $trash = $adb->dbh_do($query); } $sth->finish(); } else { PRINT "Could not prepare query: ".$sth->errstr."
\n"; } if(strstr($HTTP_REFERER, "add=1") != FALSE) { header("Location: $HTTP_REFERER"); } else { header("Location: $USERPREFIX/servers/info.php?ID=$cID\n\n"); } ?>