<?php
array_push($js_lib, "add_click_onload"); array_push($function_js_init, "add_click_onload('menu','');");
?>
	<div id="menu_inter" class="menu2">
			<?php print '<p>'.option_deplie('help_page',HELP_PAGE,true).'</p>';  ?>
			<p class="bottom"><a href="?mode=sql">Test SQL_PHP</a></p>
			<?php
			if (isset($_GET['module'])){
				include(ADD_PATH_ADMIN."include/modules/".$_GET['module']."/inc/aff_menu_inter.inc");
			}  ?>
		</div>
	<div id="article" >
		<div id="admin" class="a_box">
		<?php if (!isset($_GET['mode'])) :?>

		<?php elseif ($_GET['mode']=='sql') :?>
			<h2><?php echo EXEX_REQUTE_SQL_PHP ?></h2>
			<br />

			<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="POST">
			<table>
			<tr>
				<td>Table </td><td>Prefix</td><td>Id</td>
			</tr>
			<tr>
				<td><input type="text" name="table_sql" value="<?php print($_POST['table_sql']);?>" size="50"/></td>
				<td><input type="text" name="table_pref" value="<?php print($_POST['table_pref']);?>" size="50"/></td>
				<td><input type="text" name="table_id" value="<?php print($_POST['table_id']);?>" size="5"/></td>
			</tr>
			<tr>
				<td colspan="3"><textarea name="query_sql" id="query_sql" rows="5"><?php print stripslashes($_POST['query_sql']);?></textarea></td>
			</tr>
			<tr>
				<td></td><td><input type="submit" name='valide' value="valider"/></td>
			</tr>
			</table>
			</form>

	<!-- 			TABLE:  PREFIX (optionnel)<br /> -->



			<?php	if ($_POST['valide']){
				$table=(defined(strtoupper($_POST['table_sql']))) ? constant(strtoupper($_POST['table_sql'])) : $_POST['table_sql'];
				if(!file_exists($table)) $table=ADD_PATH_ADMIN.$table;
				$return=sql ('',$table,trim(@$_POST['table_pref']),$_POST['query_sql'],@$_POST['table_id']);
				}
				?>
			<p><code > Table: <?php print($_POST['table_sql']);?></code><br />
			<code> Query: <?php print($_POST['query_sql']);?></code><br />
			     <pre> <?php print_r($return);?></pre></p>

	<!-- 		<iframe name="my_iframe" id="my_iframe" src="blank"></iframe> -->
		<?php endif; ?>
		</div>
	</div>
	<div id="droit">
	</div>
</div>
