sql_query($sql))
{
	message_die(CRITICAL_ERROR, "Could not query config information in admin_report", "", __LINE__, __FILE__, $sql);
}
else
{
	while( $set = $db->sql_fetchrow($result) )
	{
		$config_name = $set['name'];
		$config_value = $set['value'];
		$default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value;
		$new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name];
		if( isset($HTTP_POST_VARS['submit']) )
		{
			$sql = "UPDATE " . REPORT_CONFIG . " SET
				value = '" . str_replace("\'", "''", $new[$config_name]) . "'
				WHERE name = '$config_name'";
			if( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Failed to update value for $config_name", "", __LINE__, __FILE__, $sql);
			}
		}
	}
	if( isset($HTTP_POST_VARS['submit']) )
	{
		$message = $lang['Config_updated'] . "
" . sprintf($lang['Click_return_config'], "", "") . "
" . sprintf($lang['Click_return_admin_index'], "", "");
		message_die(GENERAL_MESSAGE, $message);
	}
}
include('./page_header_admin.'.$phpEx);
//
// Output the authorisation details
//
$template->set_filenames(array(
	'body' => 'admin/report_body.tpl'
	)
);
$template->assign_vars(array(
	"S_CONFIG_ACTION" => append_sid("admin_report.$phpEx"),
    'L_TITLE' => $lang['report_title'],
    'L_EXPLAIN' => $lang['report_explain'],
    'COLOR0' => $new['color_0'],
    'COLOR1' => $new['color_1'],
    
    'L_COLOR_SET' => $lang['report_color_set'],
    'L_COLOR0' => $lang['report_color_0'],
    'L_COLOR1' => $lang['report_color_1'],
    
	"L_SUBMIT" => $lang['Submit'],
	"L_RESET" => $lang['Reset']
    )
);
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>