<?php 

/*
** SellaNMS
** $Id: clearfailure.php,v 1.10 2006/01/24 07:08:09 sella Exp $
** Copyright (c) 2001 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

require_once('config/config.php');
require_once('libs/dgsutil/cgi.php');
require_once('libs/util.php');

$db = mysql_connect($config['databaseServer'], $config['databaseUsername'], $config['databasePassword']);
mysql_select_db($config['databaseName'], $db);

$data = getFormData();

if ($data['id']) {
	$sql = sprintf("UPDATE event_data SET class = 2, description = 'cleared by user', stamp=NOW() WHERE id = %d", $data['id']);
	if (mysql_query($sql, $db) != FALSE) {
		printf("<HTML>\n");
		printf("\t<HEAD>\n");
		printf("\t\t<LINK REL=\"stylesheet\" HREF=\"common/%s.css\" TYPE=\"text/css\">\n", isset($config['css']) ? $config['css'] : 'default');

		jsLoadFrame(false);

		printf("\t</HEAD>\n");
		printf("\t<BODY onLoad=\"loadFrame('hidden', 'sella_nms.php');\" TOPMARGIN=\"0\" LEFTMARGIN=\"0\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\">\n");
		printf("\t\t<TABLE WIDTH=\"100%%\" CELLSPACING=\"1\" CELLPADDING=\"0\" BORDER=\"0\">\n");
		printf("\t\t\t<TR CLASS=\"tbltitle\">\n");
		printf("\t\t\t\t<TD NOWRAP COLSPAN=\"3\">Network Failures: Updating</TD>\n");
		printf("\t\t\t</TR>\n");
		printf("\t\t\t<TR CLASS=\"tblhdr\">\n");
		printf("\t\t\t\t<TD>\n"); printf("\t\t\t\t\tTimestamp</TD>\n");
		printf("\t\t\t\t<TD WIDTH=\"100%%\" COLSPAN=\"2\">Element</TD>\n");
		printf("\t\t\t</TR>\n");
		printf("\t\t\t<TR CLASS=\"tblentry\">\n");
		printf("\t\t\t\t<TD WIDTH=\"100%%\" COLSPAN=\"3\" ALIGN=\"left\">Please wait while the alarm is cleared...</TD>\n");
		printf("\t\t\t</TR>\n");
		printf("\t\t</TABLE>\n");
		printf("\t</BODY>\n");
		printf("</HTML>\n");

		return true;
	} else {
		printf("ERROR: could not clear failure.");
	}
}

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim:
** vim: noet ts=3 sw=3
*/

?>
