-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery.php
78 lines (53 loc) · 1.43 KB
/
query.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/*
SQL Buddy - Web based MySQL administration
http://www.sqlbuddy.com/
query.php
- query the database
MIT license
2008 Calvin Lough <http://calv.in>
*/
include "functions.php";
loginCheck();
if (isset($db))
$conn->selectDB($db);
if (isset($_POST['query']))
$query = $_POST['query'];
echo '<div style="padding-left: 5px">';
if (isset($db)) {
echo '<span style="color: rgb(135, 135, 135)">' . sprintf(__("Run a query on the %s database"), $db) . '.</span>';
}
if (isset($query)) {
$displayQuery = $query;
} else if (isset($db) && isset($table) && $conn->getAdapter() == "mysql") {
$displayQuery = "SELECT * FROM `$table` LIMIT 100";
} else if (isset($db) && isset($table) && $conn->getAdapter() == "sqlite") {
$displayQuery = "SELECT * FROM '$table' LIMIT 100";
}
?>
<form onsubmit="executeQuery(); return false;">
<table cellpadding="0" cellspacing="0" style="margin: 2px 0px">
<tr>
<td>
<textarea name="QUERY" id="QUERY"><?php
if (isset($displayQuery))
echo htmlentities($displayQuery, ENT_QUOTES, 'UTF-8');
?></textarea>
</td>
<td valign="bottom" style="padding-left: 7px">
<input type="submit" class="inputbutton" value="<?php echo __("Submit"); ?>" />
</td>
</tr>
</table>
</form>
</div>
<?php
if (isset($query)) {
echo '<div style="margin-top: 10px">';
require "includes/browse.php";
echo '</div>';
}
?>
<script type="text/javascript" authkey="<?php echo $requestKey; ?>">
$('QUERY').focus();
</script>