-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathquery.php
More file actions
77 lines (52 loc) · 1.36 KB
/
query.php
File metadata and controls
77 lines (52 loc) · 1.36 KB
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
<?php
/*
SQL Buddy - Web based MySQL administration
http://interruptorgeek.com/sql-buddy-ig-review/
query.php
- query the database
MIT license
Original : 2008 Calvin Lough <http://calv.in>
Reviewed : 2016 Carlos Martín Arnillas <https://interruptorgeek.com>
*/
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)) {
$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>