| Server IP : 104.21.25.180 / Your IP : 162.159.115.42 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/libexec/webmin/virtual-server/ |
Upload File : |
#!/usr/bin/perl
# Add some databases to this server's control
require './virtual-server-lib.pl';
&ReadParse();
&error_setup($text{'databases_ierr'});
$d = &get_domain($in{'dom'});
&can_edit_domain($d) && &can_edit_databases() && &can_import_servers() ||
&error($text{'edit_ecannot'});
&set_all_null_print();
# Check databases to import for sanity
@import = split(/\0/, $in{'import'});
foreach $tn (@import) {
($type, $db) = split(/\s+/, $tn, 2);
if ($type eq "mysql" &&
($db eq "mysql" || $db eq "information_schema")) {
&error(&text('databases_eimysql', $db));
}
elsif ($type eq "postgres" && $db =~ /^template\d+$/) {
&error(&text('databases_eipostgres', $db));
}
}
foreach $tn (@import) {
($type, $db) = split(/\s+/, $tn, 2);
@dbs = split(/\s+/, $d->{'db_'.$type});
push(@dbs, $db);
$d->{'db_'.$type} = join(" ", @dbs);
# Call the grant function to actually allow access
$gfunc = "grant_".$type."_database";
if (defined(&$gfunc)) {
&$gfunc($d, $db);
}
&webmin_log("import", "database", $db,
{ 'type' => $type, 'dom' => $d->{'dom'} });
}
&save_domain($d);
&refresh_webmin_user($d);
&run_post_actions_silently();
&redirect("list_databases.cgi?dom=$in{'dom'}");