$pool_response = send_request_to_host($arr, $host_data); sleep(2); } if (isset($_POST['saveconf'])) { $conf_path = filter_input(INPUT_POST, 'confpath', FILTER_SANITIZE_STRING); // add configuration file path to db table. It'll just fail if it's already there. $alter = "ALTER TABLE `hosts` ADD `conf_file_path` varchar(255) NULL"; $dbh->exec($alter); $updq = "UPDATE hosts SET conf_file_path = '{$conf_path}' WHERE id = {$id}"; $dbh->exec($updq); db_error(); $arr = array('command' => 'save', 'parameter' => $conf_path); $pool_response = send_request_to_host($arr, $host_data); sleep(2); // as host data is updated, re-load it. $host_data = get_host_data($id); } if (isset($_POST['restartbut']) && isset($_POST['restartchk'])) { $arr = array('command' => 'restart', 'parameter' => ''); send_request_to_host($arr, $host_data); $host_alive = FALSE; sleep(2); } if (isset($_POST['quitbut']) && isset($_POST['quitchk'])) { $arr = array('command' => 'quit', 'parameter' => ''); send_request_to_host($arr, $host_data); $host_alive = FALSE; sleep(2); } } }
<?php require "config.inc.php"; require "func.inc.php"; $dbh = anubis_db_connect(); if (!isset($id)) { $id = 0 + $_GET['id']; } if (!$id || $id == 0) { echo "Need a Host to deal with !"; die; } $config = get_config_data(); if ($host_data = get_host_data($id)) { $host_alive = get_host_status($host_data); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Anubis: Host Status</title> <?php require 'stylesheets.inc.php'; ?> <script type="text/javascript" src="scripts/jquery.min.js"></script> <script type="text/javascript" src="scripts/ddsmoothmenu.js">