-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmmrunsql.php
More file actions
77 lines (63 loc) · 1.43 KB
/
mmrunsql.php
File metadata and controls
77 lines (63 loc) · 1.43 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 // mmrunsql.php
use mondrakeNG\mm\classes\MMUser;
require_once 'mmheader.php';
if (!isset($_POST['sqlstmt']))
$sqlq = null;
else
$sqlq = stripslashes($_POST['sqlstmt']);
$retTo = $_SERVER['HTTP_REFERER'];
if (!is_null($sqlq)) {
try {
$obj = new MMUser;
$rows = $obj->query($sqlq);
}
catch(Exception $e){
$errMsg = $e->getCode() . ' - ' . $e->getMessage();
$obj = new MMUser;
foreach ($obj->getLog() as $msg) {
$errMsg .= "<br/>$msg->text";
}
}
}
echo <<<_END
<!-- The HTML section -->
<style>.signup { border: 1px solid #999999;
font: normal 12px verdana; color:#444444; }</style>
<style>.signup1 { border: 1px solid #999999;
font: normal 10px verdana; color:#444444; }</style>
</head><body>
<form method='post' action='mmrunsql.php'>
<table class="signup" >
<tr>
<td>SQL:</td>
<td><textarea class='signup' name='sqlstmt' cols='180' rows='15'>$sqlq</textarea></td>
</tr>
<tr>
<td/><td><input type='submit' value='Execute' /></td>
</tr>
_END;
if(!is_null($errMsg)) {
echo" <tr>
<td>Err:</td>
<td>$errMsg</td>
</tr>";
}
echo "</table></form><table class='signup1' border=1 cellpadding='2' cellspacing='0' bgcolor='#eeeeee'>";
echo "<tr><td/>";
foreach ($rows[0] as $a => $b) {
echo "<td>$a</td>";
}
echo "</tr>";
$j = 1;
foreach ($rows as $a => $b) {
echo "<tr><td><b>$j</b></td>";
foreach ($b as $c => $d) {
echo "<td>$d</td>";
}
echo "</tr>";
$j++;
}
echo <<<_END
</table>
_END;
?>