| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/home/SERVERWEB/webmin-2.105/custom/ |
Upload File : |
#!/usr/bin/perl
# Execute some SQL and display the result
require './custom-lib.pl';
if ($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/i) {
&ReadParseMime();
}
else {
&ReadParse();
}
&error_setup($text{'srun_err'});
$cmd = &get_command($in{'id'}, $in{'idx'});
&can_run_command($cmd) || &error($text{'run_ecannot'});
# Connect to the DB
use DBI;
$drh = DBI->install_driver($cmd->{'type'});
$drh || &error($text{'srun_edriver'});
($driver) = grep { $_->{'driver'} eq $cmd->{'type'} } &list_dbi_drivers();
$dbh = $drh->connect($driver->{'dbparam'}."=".$cmd->{'db'}.
($cmd->{'host'} ? ";host=$cmd->{'host'}" : ""),
$cmd->{'user'}, $cmd->{'pass'}, { });
$dbh || &error(&text('srun_econnect', $drh->errstr));
# Show header
&ui_print_unbuffered_header(undef, $text{'srun_title'}, "");
print &text('srun_cmd', "<tt>$cmd->{'sql'}</tt>"),"<p>\n";
# Work out params
($env, $export, $str, $displaystr, $args) = &set_parameter_envs($cmd, $cmd->{'sql'}, undef);
# Run it
$cmd = $dbh->prepare($cmd->{'sql'});
if (!$cmd) {
print &text('srun_eprepare', $dbh->errstr),"<p>\n";
}
elsif (!$cmd->execute(@$args)) {
print &text('srun_eexecute', $dbh->errstr),"<p>\n";
}
else {
# Show results
if (@titles = @{$cmd->{'NAME'}}) {
print &ui_columns_start(\@titles);
# Show results
while(my @r = $cmd->fetchrow()) {
print &ui_columns_row(\@r);
}
print &ui_columns_end();
$cmd->finish();
}
else {
$r = $cmd->finish();
print &text('srun_none', $r),"<p>\n";
}
}
&ui_print_footer("", $text{'index_return'});