'; print_input_hidden ("server",$id_server); $table->cellpadding=4; $table->cellspacing=4; $table->width=450; $table->class="databox_color"; $table->data[] = array (__('Name'),print_input_text ('name',$row["name"],'',50,0,true)); $table->data[] = array (__('IP Address'),print_input_text ('address',$row["ip_address"],'',50,0,true)); $table->data[] = array (__('Description'),print_input_text ('description',$row["description"],'',50,0,true)); print_table ($table); echo '
'; echo ''; echo "
"; } else { print_page_header (__('Manage servers'), "", false, "", true); if (isset ($_GET["delete"])) { $id_server = get_parameter_get ("server_del"); $sql = sprintf ("DELETE FROM tserver WHERE id_server='%d'",$id_server); $result = process_sql ($sql); if ($result !== false) { echo '

'.__('Server deleted successfully').'

'; } else { echo '

'.__('There was a problem deleting the server').'

'; } } elseif (isset($_GET["update"])) { $name = get_parameter_post ("name"); $address = get_parameter_post ("address"); $description = get_parameter_post ("description"); $id_server = get_parameter_post ("server"); $sql = sprintf ("UPDATE tserver SET name = '%s', ip_address = '%s', description = '%s' WHERE id_server = %d", $name, $address, $description, $id_server); $result = process_sql ($sql); if ($result !== false) { echo '

'.__('Server updated successfully').'

'; } else { echo '

'.__('There was a problem updating the server').'

'; } } $servers = get_server_info (); if ($servers !== false) { $table->width = "90%"; $table->class = "databox"; $table->data = array (); $table->align = array (); $table->align[1] = "center"; $table->align[2] = "center"; $table->align[3] = "center"; $table->align[4] = "center"; $table->align[5] = "center"; $table->align[6] = "center"; $table->align[7] = "center"; $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->head = array (); $table->head[0] = __('Name'); $table->head[1] = __('Status'); $table->head[2] = __('Description'); $table->head[3] = __('Type'); $table->head[4] = __('Started'); $table->head[5] = __('Updated'); $table->head[6] = __('Delete'); foreach ($servers as $server) { if ($server['status'] == 0) { $server_status = print_status_image (STATUS_SERVER_DOWN, '', true); } else { $server_status = print_status_image (STATUS_SERVER_OK, '', true); } $data = array (); $data[0] = ''.$server["name"].''; $data[1] = $server_status; $data[2] = substr ($server["description"], 0, 25); $data[3] = $server['img']; $data[4] = human_time_comparation ($server["laststart"]); $data[5] = human_time_comparation ($server["keepalive"]); $data[6] = ''; $data[6] .= print_image ('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" . __('Modules run by this server will stop working. Do you want to continue?') ."')) return false")); $data[6] .= ''; array_push ($table->data, $data); } print_table ($table); //Legend echo ""; echo ""; echo ''; echo ''; echo ''; echo ''; echo ''; echo "
'.__('Network server').''.__('Master').''.__('Data server').''.__('MD5 check').''.__('SNMP console').'
"; } else { echo "
".__('There are no servers configured into the database')."
"; } } ?>