Ejemplo n.º 1
0
         if (($value = $db->dbQuery($val->ValidateSQL($query, $dbconn), $dbconn)) === -1) {
             $error = $err->GenerateErrorLink("help/help.html", "#host_search", $defined['error'], $errors['db_search_err'], NULL, NULL);
         } else {
             // process results of search
             if ($db->dbNumRows($value) >= 1) {
                 $data = $db->dbArrayResultsAssoc($value);
                 if ($db->dbNumRows($value) === 1) {
                     $id = $data[0]['id'];
                     $hostname = $data[0]['hostname'];
                     $mac_address = $data[0]['mac-address'];
                     $ip_address = $data[0]['ip-address'];
                     $subnet_name = $data[0]['subnet-name'];
                     $pxe_group = $data[0]['pxe-group'];
                     $error = $err->GenerateErrorLink("help/help.html", "#host_search", $defined['good'], "Your search for '" . $val->ValidateXSS($search) . "' returned '" . $db->dbNumRows($value) . "' results. The form has been populated for you to edit record #" . $id, NULL, NULL);
                 } else {
                     $hosts_list = $misc->GenJumpMenuBoxHOSTS($data, 'hosts_list', $_GET['skin'], NULL);
                     $error = $err->GenerateErrorLink("help/help.html", "#host_search", $defined['good'], "Your search for '" . $val->ValidateXSS($search) . "' returned '" . $db->dbNumRows($value) . "' results. Please select the host you wish to edit from the select box below", NULL, NULL);
                 }
             } else {
                 $error = $err->GenerateErrorLink("help/help.html", "#host_search", $defined['error'], $errors['sql_empty'], NULL, NULL);
             }
         }
     } else {
         $search_err = $err->GenerateErrorImg($defined['error'], "help/help.html#host_search", '800', '800');
         $list = "<ol><li>Search string is invalid. Allowed formats:<br>MAC Address: xx:xx:xx:xx:xx<br>IPv4 Address: xxx.xxx.xxx.xxx<br>Hostname: [0-9a-z]</li></ol>";
         $error = $err->GenerateErrorLink("help/help.html", "#host_search", $defined['error'], $errors['val_host'] . $list, NULL, NULL);
     }
 } else {
     $sql_success = -1;
     // check each post element
     if (!empty($hostname) && !empty($mac_address) && !empty($ip_address) && !empty($subnet_name)) {