%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.248 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/mysql/ |
Upload File : |
#!/usr/bin/perl # save_host.cgi # Save, create or delete a host table record require './mysql-lib.pl'; &ReadParse(); $access{'perms'} || &error($text{'perms_ecannot'}); if ($in{'delete'}) { # Delete some host $access{'perms'} == 1 || &can_edit_db($in{'olddb'}) || &error($text{'perms_edb'}); &execute_sql_logged($master_db, "delete from host where host = '$in{'oldhost'}' ". "and db = '$in{'olddb'}'"); } else { # Validate inputs &error_setup($text{'host_err'}); $in{'host_def'} || $in{'host'} =~ /^\S+$/ || &error($text{'host_ehost'}); if ($access{'perms'} == 2 && $access{'dbs'} ne '*') { $db = $in{'dbs'}; } else { $db = $in{'db_def'} == 1 ? "" : $in{'db_def'} == 2 ? $in{'dbs'} : $in{'db'}; $db =~ /^\S*$/ || &error($text{'host_edb'}); } if ($access{'perms'} == 2) { $in{'new'} || &can_edit_db($in{'olddb'}) || &error($text{'perms_edb'}); &can_edit_db($db) || &error($text{'perms_edb'}); } %perms = map { $_, 1 } split(/\0/, $in{'perms'}); @desc = &table_structure($master_db, 'host'); @pfields = map { $_->[0] } &priv_fields('host'); $host = $in{'host_def'} ? '%' : $in{'host'}; if ($in{'new'}) { # Create a new host $sql = "insert into host (host, db, ". join(", ", @pfields). ") values (?, ?, ". join(", ", map { "?" } @pfields).")"; &execute_sql_logged($master_db, $sql, $host, $db, (map { $perms{$_} ? 'Y' : 'N' } @pfields)); } else { # Update existing host $sql = "update host set host = ?, db = ?, ". join(", ",map { "$_ = ?" } @pfields). " where host = ? and db = ?"; &execute_sql_logged($master_db, $sql, $host, $db, (map { $perms{$_} ? 'Y' : 'N' } @pfields), $in{'oldhost'}, $in{'olddb'}); } } &execute_sql_logged($master_db, 'flush privileges'); if ($in{'delete'}) { &webmin_log("delete", "host", $in{'oldhost'}, { 'db' => $in{'olddb'}, 'host' => $in{'oldhost'} } ); } elsif ($in{'new'}) { &webmin_log("create", "host", $in{'host_def'} ? '' : $in{'host'}, { 'db' => $db, 'host' => $in{'host_def'} ? '' : $in{'host'} } ); } else { &webmin_log("modify", "host", $in{'host_def'} ? '' : $in{'host'}, { 'db' => $db, 'host' => $in{'host_def'} ? '' : $in{'host'} } ); } &redirect("list_hosts.cgi");