-
Notifications
You must be signed in to change notification settings - Fork 30
/
ajaxfulltext.php
64 lines (42 loc) · 1.22 KB
/
ajaxfulltext.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
<?php
/*
SQL Buddy - Web based MySQL administration
http://interruptorgeek.com/sql-buddy-ig-review/
ajaxfulltext.php
- fetches full text for browse tab
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'])) {
$queryList = splitQueryText($_POST['query']);
foreach ($queryList as $query) {
$sql = $conn->query($query);
}
}
$structureSql = $conn->describeTable($table);
while ($structureRow = $conn->fetchAssoc($structureSql)) {
$types[$structureRow['Field']] = $structureRow['Type'];
}
if ($conn->isResultSet($sql)) {
$row = $conn->fetchAssoc($sql);
foreach ($row as $key => $value) {
echo "<div class=\"fulltexttitle\">" . $key . "</div>";
echo "<div class=\"fulltextbody\">";
$curtype = $types[$key];
if (strpos(" ", $curtype) > 0) {
$curtype = substr($curtype, 0, strpos(" ", $curtype));
}
if ($value && isset($binaryDTs) && in_array($curtype, $binaryDTs)) {
echo '<span class="binary">(' . __("binary data") . ')</span>';
} else {
echo nl2br(htmlentities($value, ENT_QUOTES, 'UTF-8'));
}
echo "</div>";
}
}
?>