<?php
	
	echo "<html><head><title>SQL Query Sender</title></head><body>";

	if (ini_get("magic_quotes_gpc") == "1")
	{
		$_POST['query'] = stripslashes($_POST['query']);
	}


	if (@$_POST['queryButton'] != "Edit Query")
	{
		$query = " ";
	}
	else
	{
		$query = str_replace( "%&%", "'", $_POST['query']);
	}

	echo "<br><br>";

	echo "<form action='sql_results.php?db=".$_GET['db']."' method='POST'>";

?>


<table>
<tr><td><b>Password</b></td><td><input type="password" name="password"></input></td></tr>
<tr><td><b>Table layout</b></td><td><input type='checkbox' name='table_layout' checked></input></td></tr>
<tr><td><b><br>Type in SQL query</b></td><td><br><textarea name="query" cols="60" rows="10"><?php echo $query ?></textarea></td></tr>
<tr><td><b>Live update</b></td><td><input type='checkbox' name='live_update'></input></td></tr>
<tr><td></td><td align='center'><br><input type="submit" value="Submit Query"></td></tr>
</table>
</form>
</body>
</html>


