<?php
define( 'SF_ROOT_DIR', "../../" );
define( 'SF_APP',      'sys' );

require_once( SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'configGlobal.php' );

$cn = Conexion::getConexion();

if( !empty( $_POST['Control'] ) )
{
    if( !empty( $_POST['txtQuery'] ) )
    {
        mysql_query( $_POST['txtQuery'], $cn->getResource() );
        if( mysql_error() )
        {
            pr( "Se ejecuto el Query con Errores." );
            pr( mysql_error() );
        }
        else
        {
            pr( "Se ejecuto el Query." );
        }
    }
    else
    {
        pr( "No se encontro Query." );
    }
}

?>
<?php $dir_url = Constantes::ROOT_DIR_APP ?>
<body style="margin: 20px;">
    <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $dir_url ?>/web/css/jquery/default/main.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $dir_url ?>/web/css/jquery/default/grid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $dir_url ?>/web/css/jquery/default/tab.css" />
              
    <script type="text/javascript" src="<?php echo $dir_url ?>/web/js/jquery/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="<?php echo $dir_url ?>/web/js/jquery/ui-1.10.3/jquery-ui.js"></script>

<style>
.grid
{
    border: 1px solid #77d5f7;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
}
.grid th 
{
    border-color: #77d5f7;
    background-color: #0a7db1;
    font-weight: normal;
    font-size: 11px;
    font-family: Verdana,Arial,sans-serif;
    height: 24px;
    padding: 0 2px;
}
.grid td 
{
    border-left: 0 none;
    border-right-color: #77d5f7;
    border-right-style: solid;
    border-right-width: 1px;
    border-bottom-color: #77d5f7;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    padding: 0 2px;
    /*white-space: pre;*/
    height: 22px;
    /*border: 1px solid #77d5f7;*/
}
.grid td div
{
    overflow: hidden; white-space: nowrap; width: 150px; font-size: 10px;
}
</style>

<form id="form1" name="form1" method="POST" enctype="multipart/form-data">

    <input type="hidden" name="Control" value="ok"/>
    <input type="hidden" name="Tipo" id="Tipo" value=""/>

    <input type="hidden" name="Secuencia" id="Secuencia" value=""/>

    <hr>

    <table cellpadding="10" cellspacing="10" border="0">
        <td>
            Ingrese Query
        </td>
        <td>&nbsp;&nbsp;</td>
        <td>
            <textarea class="" name="txtQuery" id="txtQuery" cols="100" rows="5"  ></textarea>
        </td>
        <td>
            <input type="submit" value="EJECUTAR" onclick="$( '#Tipo' ).val( 'FIND_PROD' );"><br>
            <input type="button" value="LIMPIAR" onclick="location.href='<?php echo Constantes::ROOT_DIR_APP?>web/tools/execute_query.php'">
        </td>
    </table>

</form>