| 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
# Save, create or delete an SQL command
require './custom-lib.pl';
&ReadParse();
$access{'edit'} || &error($text{'save_ecannot'});
if ($in{'delete'}) {
$cmd = &get_command($in{'id'}, $in{'idx'});
&delete_command($cmd);
&webmin_log("delete", "command", $cmd->{'id'}, $cmd);
&redirect("");
}
elsif ($in{'clone'}) {
&redirect("edit_sql.cgi?id=$in{'id'}&idx=$in{'idx'}&clone=1&new=1");
}
else {
&error_setup($text{'sql_err'});
if (!$in{'new'}) {
$cmd = &get_command($in{'id'}, $in{'idx'});
}
else {
$cmd = { 'id' => time() };
}
# parse and validate inputs
$cmd->{'desc'} = $in{'desc'};
$in{'order_def'} || $in{'order'} =~ /^\-?(\d+)$/ ||
&error($text{'save_eorder'});
$cmd->{'order'} = $in{'order_def'} ? 0 : int($in{'order'});
$in{'html'} =~ s/\r//g;
$in{'html'} =~ s/\n*/\n/;
$cmd->{'html'} = $in{'html'};
$cmd->{'type'} = $in{'type'};
$in{'db'} =~ /^\S+$/ || &error($text{'sql_edb'});
$cmd->{'db'} = $in{'db'};
$in{'sql'} =~ /\S/ || &error($text{'sql_esql'});
$in{'sql'} =~ s/\r//g;
$cmd->{'sql'} = $in{'sql'};
$cmd->{'user'} = $in{'dbuser'};
$cmd->{'pass'} = $in{'dbpass'};
if ($in{'host_def'}) {
delete($cmd->{'host'});
}
else {
&to_ipaddress($in{'host'}) ||
&error($text{'sql_ehost'});
$cmd->{'host'} = $in{'host'};
}
&parse_params_inputs($cmd);
&save_command($cmd);
&webmin_log($in{'new'} ? "create" : "modify", "command",
$cmd->{'id'}, $cmd);
if ($in{'new'} && $access{'cmds'} ne '*') {
$access{'cmds'} .= " ".$cmd->{'id'};
&save_module_acl(\%access);
}
&redirect("");
}