'; echo "This is an advanced extension to interface with Pandora FMS database directly from WEB console using native SQL sentences. Please note that you can damage your Pandora FMS installation if you don't know exactly what are you are doing, this means that you can severily damage your setup using this extension. This extension is intended to be used only by experienced users with a depth knowledge of Pandora FMS internals."; echo ''; echo "
"; echo "Some samples of usage:
SHOW STATUS;
DESCRIBE tagente
SELECT * FROM tserver
UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'
"; echo "

"; echo "
"; html_print_textarea ('sql', 5, 50, html_entity_decode($sql, ENT_QUOTES)); echo '
'; echo '
'; echo '
'; html_print_submit_button (__('Execute SQL'), '', false, 'class="sub next"'); echo '
'; echo "
"; // Processing SQL Code if ($sql == '') return; echo "
"; echo "
"; echo "
"; $error = ''; $result = dbmanager_query ($sql, $error); if ($result === false) { echo 'An error has occured when querying the database.
'; echo $error; db_pandora_audit("Extension DB inface", "Error in SQL", false, false, $sql); return; } if (! is_array ($result)) { echo "Output: ".$result; db_pandora_audit("Extension DB inface", "SQL", false, false, $sql); return; } echo "
"; $table->width = '100%'; $table->class = 'databox data'; $table->head = array_keys ($result[0]); $table->data = $result; html_print_table ($table); echo "
"; } /* This adds a option in the operation menu */ extensions_add_godmode_menu_option (__('DB interface'), 'PM','gextensions',"dbmanager/icon.png","v1r1", 'gdbman'); /* This sets the function to be called when the extension is selected in the operation menu */ extensions_add_godmode_function ('dbmgr_extension_main'); ?>