".__('Extensions'). " » ".__('Database interface').""; echo '
'; 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 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 knowledgue 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 "
"; print_textarea ('sql', 5, 40, html_entity_decode($sql, ENT_QUOTES)); echo '
'; echo '
'; 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; return; } if (! is_array ($result)) { echo "Output: ".$result; return; } $table->width = '90%'; $table->class = 'dbmanager'; $table->head = array_keys ($result[0]); $table->data = $result; print_table ($table); } /* This adds a option in the operation menu */ add_godmode_menu_option (__('DB interface'), 'PM','gdbman',"dbmanager/icon.png"); /* This sets the function to be called when the extension is selected in the operation menu */ add_extension_godmode_function ('dbmgr_extension_main'); ?>